mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[MSAFD]
- Print the caller in MsafdReturnWithErrno - Initialize SockAsyncCompletionPort handle - Check if the creation of the completion port failed - Defer free of the socket information struct until the socket handle has been closed because the socket may have a pending select. When the socket is closed, the pending select is canceled, thus a apc routine is invoked which access the freed socket information struct. - Fixes mIRC crash - Should be merged to 0.3.13 branch svn path=/trunk/; revision=51047
This commit is contained in:
parent
95dbb35059
commit
3f8643ca67
2 changed files with 9 additions and 5 deletions
|
@ -27,7 +27,7 @@ CRITICAL_SECTION SocketListLock;
|
|||
LIST_ENTRY SockHelpersListHead = { NULL, NULL };
|
||||
ULONG SockAsyncThreadRefCount;
|
||||
HANDLE SockAsyncHelperAfdHandle;
|
||||
HANDLE SockAsyncCompletionPort;
|
||||
HANDLE SockAsyncCompletionPort = NULL;
|
||||
BOOLEAN SockAsyncSelectCalled;
|
||||
|
||||
|
||||
|
@ -562,12 +562,11 @@ WSPCloseSocket(IN SOCKET Handle,
|
|||
}
|
||||
LeaveCriticalSection(&SocketListLock);
|
||||
|
||||
HeapFree(GlobalHeap, 0, Socket);
|
||||
|
||||
/* Close the handle */
|
||||
NtClose((HANDLE)Handle);
|
||||
NtClose(SockEvent);
|
||||
|
||||
HeapFree(GlobalHeap, 0, Socket);
|
||||
return MsafdReturnWithErrno(Status, lpErrno, 0, NULL);
|
||||
}
|
||||
|
||||
|
@ -2420,6 +2419,7 @@ BOOLEAN SockCreateOrReferenceAsyncThread(VOID)
|
|||
/* Check if the Thread Already Exists */
|
||||
if (SockAsyncThreadRefCount)
|
||||
{
|
||||
ASSERT(SockAsyncCompletionPort);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2430,7 +2430,11 @@ BOOLEAN SockCreateOrReferenceAsyncThread(VOID)
|
|||
IO_COMPLETION_ALL_ACCESS,
|
||||
NULL,
|
||||
2); // Allow 2 threads only
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
AFD_DbgPrint(MID_TRACE,("Failed to create completion port\n"));
|
||||
return FALSE;
|
||||
}
|
||||
/* Protect Handle */
|
||||
HandleFlags.ProtectFromClose = TRUE;
|
||||
HandleFlags.Inherit = FALSE;
|
||||
|
|
|
@ -488,7 +488,7 @@ MsafdReturnWithErrno(NTSTATUS Status,
|
|||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("%s: Received invalid lpErrno pointer!\n", __FUNCTION__);
|
||||
DbgPrint("%s: Received invalid lpErrno pointer! %s\n", __FUNCTION__);
|
||||
|
||||
if (ReturnedBytes)
|
||||
*ReturnedBytes = (Status == STATUS_SUCCESS) ? Received : 0;
|
||||
|
|
Loading…
Reference in a new issue