Sfoglia il codice sorgente

Added a new method to prepare the response PDUs to a completed SCSI command

Tal Aloni 8 anni fa
parent
commit
5e4cbd056f
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      ISCSI/Server/TargetResponseHelper.cs

+ 6 - 1
ISCSI/Server/TargetResponseHelper.cs

@@ -125,11 +125,16 @@ namespace ISCSI.Server
 
         internal static List<ISCSIPDU> GetSCSICommandResponse(SCSICommandPDU command, ISCSITarget target, SessionParameters session, ConnectionParameters connection)
         {
-            List<ISCSIPDU> responseList = new List<ISCSIPDU>();
             string connectionIdentifier = StateObject.GetConnectionIdentifier(session, connection);
             ISCSIServer.Log("[{0}] Executing Command: CmdSN: {1}", connectionIdentifier, command.CmdSN);
             byte[] scsiResponse;
             SCSIStatusCodeName status = target.ExecuteCommand(command.CommandDescriptorBlock, command.LUN, command.Data, out scsiResponse);
+            return PrepareSCSICommandResponse(command, status, scsiResponse, connection);
+        }
+
+        internal static List<ISCSIPDU> PrepareSCSICommandResponse(SCSICommandPDU command, SCSIStatusCodeName status, byte[] scsiResponse, ConnectionParameters connection)
+        {
+            List<ISCSIPDU> responseList = new List<ISCSIPDU>();
             if (!command.Read || status != SCSIStatusCodeName.Good)
             {
                 // RFC 3720: if the command is completed with an error, then the response and sense data MUST be sent in a SCSI Response PDU