From d774499bf89c21e2fda3995d27209c1edbe3c6d5 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Thu, 23 Sep 2004 14:16:27 +0000 Subject: [PATCH] event.c: Don't infinite loop while completing a zero-length read. tcp.c: Correctly pass on length in recv. svn path=/trunk/; revision=10999 --- reactos/drivers/net/tcpip/transport/tcp/event.c | 11 +++++++---- reactos/drivers/net/tcpip/transport/tcp/tcp.c | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/net/tcpip/transport/tcp/event.c b/reactos/drivers/net/tcpip/transport/tcp/event.c index ceca2b3e4cc..099e9f6be65 100644 --- a/reactos/drivers/net/tcpip/transport/tcp/event.c +++ b/reactos/drivers/net/tcpip/transport/tcp/event.c @@ -91,12 +91,15 @@ int TCPSocketState(void *ClientData, ("Completing Receive Request: %x\n", Bucket->Request)); - Complete( Bucket->Request.RequestContext, - STATUS_SUCCESS, - Received ); - } else { + Complete( Bucket->Request.RequestContext, + STATUS_SUCCESS, Received ); + } else if( Status == STATUS_SUCCESS ) { InsertHeadList( &Connection->ReceiveRequest, &Bucket->Entry ); + break; + } else { + Complete( Bucket->Request.RequestContext, Status, 0 ); + break; } } } diff --git a/reactos/drivers/net/tcpip/transport/tcp/tcp.c b/reactos/drivers/net/tcpip/transport/tcp/tcp.c index 06aeeca0f71..6265d4b4735 100644 --- a/reactos/drivers/net/tcpip/transport/tcp/tcp.c +++ b/reactos/drivers/net/tcpip/transport/tcp/tcp.c @@ -317,6 +317,7 @@ NTSTATUS TCPReceiveData Status = STATUS_PENDING; } else { TI_DbgPrint(MID_TRACE,("Got status %x, bytes %d\n", Status, Received)); + *BytesReceived = Received; } KeReleaseSpinLock(&Connection->Lock, OldIrql);