mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 12:08:55 +00:00
Set nonblocking on all sockets initially.
Zero flags and other junk in the ea buffer when creating a new socket. More correct error return function (check both Errno and ReturnedBytes ptrs). svn path=/trunk/; revision=13738
This commit is contained in:
parent
9127a1ca9d
commit
333c14350e
1 changed files with 23 additions and 15 deletions
|
@ -16,8 +16,8 @@
|
|||
#include <rosrtl/string.h>
|
||||
|
||||
#ifdef DBG
|
||||
DWORD DebugTraceLevel = DEBUG_ULTRA;
|
||||
//DWORD DebugTraceLevel = 0;
|
||||
//DWORD DebugTraceLevel = DEBUG_ULTRA;
|
||||
DWORD DebugTraceLevel = 0;
|
||||
#endif /* DBG */
|
||||
|
||||
HANDLE GlobalHeap;
|
||||
|
@ -120,6 +120,7 @@ WSPSocket(
|
|||
Socket->SharedData.GroupID = g;
|
||||
Socket->SharedData.GroupType = 0;
|
||||
Socket->SharedData.UseSAN = FALSE;
|
||||
Socket->SharedData.NonBlocking = FALSE; /* Sockets start blocking */
|
||||
Socket->SanData = NULL;
|
||||
|
||||
/* Ask alex about this */
|
||||
|
@ -137,6 +138,7 @@ WSPSocket(
|
|||
|
||||
/* Set up EA Buffer */
|
||||
EABuffer = HeapAlloc(GlobalHeap, 0, SizeOfEA);
|
||||
RtlZeroMemory(EABuffer, SizeOfEA);
|
||||
EABuffer->NextEntryOffset = 0;
|
||||
EABuffer->Flags = 0;
|
||||
EABuffer->EaNameLength = AFD_PACKET_COMMAND_LENGTH;
|
||||
|
@ -265,6 +267,8 @@ error:
|
|||
|
||||
DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
|
||||
LPDWORD ReturnedBytes ) {
|
||||
if( ReturnedBytes ) *ReturnedBytes = 0;
|
||||
if( Errno ) {
|
||||
switch (Status) {
|
||||
case STATUS_CANT_WAIT: *Errno = WSAEWOULDBLOCK; break;
|
||||
case STATUS_TIMEOUT:
|
||||
|
@ -279,6 +283,7 @@ DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
|
|||
*Errno = WSAEINVAL; break;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Success */
|
||||
return Status == STATUS_SUCCESS ? 0 : SOCKET_ERROR;
|
||||
|
@ -588,6 +593,9 @@ WSPSelect(
|
|||
PollBufferSize = sizeof(*PollInfo) +
|
||||
(HandleCount * sizeof(AFD_HANDLE));
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("HandleCount: %d BufferSize: %d\n",
|
||||
HandleCount, PollBufferSize));
|
||||
|
||||
/* Allocate */
|
||||
PollBuffer = HeapAlloc(GlobalHeap, 0, PollBufferSize);
|
||||
PollInfo = (PAFD_POLL_INFO)PollBuffer;
|
||||
|
|
Loading…
Reference in a new issue