Преглед изворни кода

Added support for InitialR2T = False

Tal Aloni пре 8 година
родитељ
комит
d8a5566d2c

+ 1 - 1
ISCSI/ISCSI.Server/ISCSIServer.Parameters.cs

@@ -21,7 +21,7 @@ namespace ISCSI.Server
         public class DesiredParameters
         {
             // Session parameters that will be offered to the initiator:
-            public static bool InitialR2T = true; // implementation limit
+            public static bool InitialR2T = false;
             public static bool ImmediateData = true;
             public static int MaxBurstLength = DefaultParameters.Session.MaxBurstLength;
             public static int FirstBurstLength = DefaultParameters.Session.FirstBurstLength;

+ 6 - 0
ISCSI/ISCSI.Server/TargetResponseHelper.cs

@@ -35,6 +35,12 @@ namespace ISCSI.Server
                 // Send R2Ts:
                 uint bytesLeft = command.ExpectedDataTransferLength - command.DataSegmentLength;
                 uint nextOffset = command.DataSegmentLength;
+                if (!session.InitialR2T)
+                {
+                    uint firstDataPDULength = Math.Min((uint)session.FirstBurstLength, command.ExpectedDataTransferLength) - command.DataSegmentLength;
+                    bytesLeft -= firstDataPDULength;
+                    nextOffset += firstDataPDULength;
+                }
                 int totalR2Ts = (int)Math.Ceiling((double)bytesLeft / connection.TargetMaxRecvDataSegmentLength);
                 int outgoingR2Ts = Math.Min(session.MaxOutstandingR2T, totalR2Ts);