Author: cgutman Date: Mon Aug 8 21:23:24 2011 New Revision: 53141
URL: http://svn.reactos.org/svn/reactos?rev=53141&view=rev Log: [AFD] - Fix shutdown(SD_RECEIVE) so it no longer brings down the entire connection
Modified: trunk/reactos/drivers/network/afd/afd/main.c
Modified: trunk/reactos/drivers/network/afd/afd/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/mai... ============================================================================== --- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Mon Aug 8 21:23:24 2011 @@ -670,7 +670,7 @@ PAFD_FCB FCB = FileObject->FsContext; PAFD_DISCONNECT_INFO DisReq; NTSTATUS Status = STATUS_SUCCESS; - USHORT Flags = 0; + USHORT Flags; PLIST_ENTRY CurrentEntry; PIRP CurrentIrp;
@@ -680,11 +680,38 @@ return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
- if( DisReq->DisconnectType & AFD_DISCONNECT_SEND ) - Flags |= TDI_DISCONNECT_RELEASE; - if( DisReq->DisconnectType & AFD_DISCONNECT_RECV || - DisReq->DisconnectType & AFD_DISCONNECT_ABORT ) - Flags |= TDI_DISCONNECT_ABORT; + /* Shutdown(SD_SEND) */ + if ((DisReq->DisconnectType & AFD_DISCONNECT_SEND) && + !(DisReq->DisconnectType & AFD_DISCONNECT_RECV)) + { + /* Perform a controlled disconnect */ + Flags = TDI_DISCONNECT_RELEASE; + } + /* Shutdown(SD_RECEIVE) */ + else if (DisReq->DisconnectType & AFD_DISCONNECT_RECV) + { + /* Mark that we can't issue another receive request */ + FCB->TdiReceiveClosed = TRUE; + + /* Discard any pending data */ + FCB->Recv.Content = 0; + FCB->Recv.BytesUsed = 0; + + /* Mark us as overread to complete future reads with an error */ + FCB->Overread = TRUE; + + /* Clear the receive event */ + FCB->PollState &= ~AFD_EVENT_RECEIVE; + + /* We're done (no need to tell the TDI transport driver) */ + return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0 ); + } + /* Shutdown(SD_BOTH) */ + else + { + /* Perform an abortive disconnect */ + Flags = TDI_DISCONNECT_ABORT; + }
if (!(FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS)) {