Author: cgutman
Date: Sun Jul 3 16:24:19 2011
New Revision: 52518
URL:
http://svn.reactos.org/svn/reactos?rev=52518&view=rev
Log:
[MSAFD]
- Only shutdown the socket if it has not already been shutdown
- Fixes EINVAL messages
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sun Jul 3 16:24:19 2011
@@ -514,24 +514,28 @@
{
DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(0);
DisconnectInfo.DisconnectType = LingerWait < 0 ? AFD_DISCONNECT_SEND :
AFD_DISCONNECT_ABORT;
-
- /* Send IOCTL */
- Status = NtDeviceIoControlFile((HANDLE)Handle,
- SockEvent,
- NULL,
- NULL,
- &IoStatusBlock,
- IOCTL_AFD_DISCONNECT,
- &DisconnectInfo,
- sizeof(DisconnectInfo),
- NULL,
- 0);
-
- /* Wait for return */
- if (Status == STATUS_PENDING)
+
+ if (((DisconnectInfo.DisconnectType & AFD_DISCONNECT_SEND) &&
(!Socket->SharedData.SendShutdown)) ||
+ ((DisconnectInfo.DisconnectType & AFD_DISCONNECT_ABORT) &&
(!Socket->SharedData.ReceiveShutdown)))
{
- WaitForSingleObject(SockEvent, INFINITE);
- Status = IoStatusBlock.Status;
+ /* Send IOCTL */
+ Status = NtDeviceIoControlFile((HANDLE)Handle,
+ SockEvent,
+ NULL,
+ NULL,
+ &IoStatusBlock,
+ IOCTL_AFD_DISCONNECT,
+ &DisconnectInfo,
+ sizeof(DisconnectInfo),
+ NULL,
+ 0);
+
+ /* Wait for return */
+ if (Status == STATUS_PENDING)
+ {
+ WaitForSingleObject(SockEvent, INFINITE);
+ Status = IoStatusBlock.Status;
+ }
}
}
}