[TCPIP]
[reactos.git] / reactos / lib / drivers / ip / transport / tcp / tcp.c
index dc8afbf..68b18f2 100644 (file)
@@ -34,13 +34,12 @@ DisconnectTimeoutDpc(PKDPC Dpc,
     PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)DeferredContext;
     PLIST_ENTRY Entry;
     PTDI_BUCKET Bucket;
-    NTSTATUS Status;
-    
+
     LockObjectAtDpcLevel(Connection);
-    
+
     /* We timed out waiting for pending sends so force it to shutdown */
-    Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1));
-    
+    TCPTranslateError(LibTCPShutdown(Connection, 0, 1));
+
     while (!IsListEmpty(&Connection->SendRequest))
     {
         Entry = RemoveHeadList(&Connection->SendRequest);
@@ -151,12 +150,9 @@ NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection,
 NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection )
 {
     KIRQL OldIrql;
-    PVOID Socket;
 
     LockObject(Connection, &OldIrql);
 
-    Socket = Connection->SocketContext;
-
     FlushAllQueues(Connection, STATUS_CANCELLED);
 
     LibTCPClose(Connection, FALSE, TRUE);
@@ -548,6 +544,7 @@ NTSTATUS TCPSendData
     Status = TCPTranslateError(LibTCPSend(Connection,
                                           BufferData,
                                           SendLength,
+                                          BytesSent,
                                           FALSE));
     
     TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Send: %x, %d\n", Status, SendLength));
@@ -566,19 +563,10 @@ NTSTATUS TCPSendData
         
         Bucket->Request.RequestNotifyObject = Complete;
         Bucket->Request.RequestContext = Context;
-        *BytesSent = 0;
         
         InsertTailList( &Connection->SendRequest, &Bucket->Entry );
         TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Queued write irp\n"));
     }
-    else if (Status == STATUS_SUCCESS)
-    {
-        *BytesSent = SendLength;
-    }
-    else
-    {
-        *BytesSent = 0;
-    }
 
     UnlockObject(Connection, OldIrql);
 
@@ -640,6 +628,9 @@ NTSTATUS TCPGetSockAddress
     UnlockObject(Connection, OldIrql);
     
     AddressIP->Address[0].Address[0].in_addr = ipaddr.addr;
+    
+    RtlZeroMemory(&AddressIP->Address[0].Address[0].sin_zero,
+                  sizeof(AddressIP->Address[0].Address[0].sin_zero));
 
     return Status;
 }
@@ -683,4 +674,20 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp )
     return Found;
 }
 
+NTSTATUS
+TCPSetNoDelay(
+    PCONNECTION_ENDPOINT Connection,
+    BOOLEAN Set)
+{
+    if (!Connection)
+        return STATUS_UNSUCCESSFUL;
+
+    if (Connection->SocketContext == NULL)
+        return STATUS_UNSUCCESSFUL;
+
+    LibTCPSetNoDelay(Connection->SocketContext, Set);
+    return STATUS_SUCCESS;
+}
+
+
 /* EOF */