mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
- Implement OskitTCPGetSocketError which retreives so->so_error
- Use OskitTCPGetSocketError to get the actual socket error which occurred when get SEL_FIN - Add more cases to TCPTranslateError svn path=/trunk/; revision=44199
This commit is contained in:
parent
55d1ffb642
commit
a2350b62d8
3 changed files with 36 additions and 7 deletions
|
@ -27,6 +27,7 @@ static VOID DrainSignals() {
|
|||
PLIST_ENTRY Entry;
|
||||
PIRP Irp;
|
||||
PMDL Mdl;
|
||||
ULONG SocketError;
|
||||
|
||||
KeAcquireSpinLock(&ConnectionEndpointListLock, &OldIrql);
|
||||
CurrentEntry = ConnectionEndpointListHead.Flink;
|
||||
|
@ -44,16 +45,27 @@ static VOID DrainSignals() {
|
|||
Connection, Connection->SocketContext));
|
||||
|
||||
if( !Connection->SocketContext || Connection->SignalState & SEL_FIN ) {
|
||||
KeReleaseSpinLock(&Connection->Lock, OldIrql);
|
||||
TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));
|
||||
|
||||
Connection->SignalState = 0;
|
||||
|
||||
/* If OskitTCP initiated the disconnect, try to read the socket error that occurred */
|
||||
if (Connection->SocketContext)
|
||||
SocketError = TCPTranslateError(OskitTCPGetSocketError(Connection->SocketContext));
|
||||
|
||||
/* Default to STATUS_CANCELLED if we initiated the disconnect or no socket error was reported */
|
||||
if (!Connection->SocketContext || !SocketError)
|
||||
SocketError = STATUS_CANCELLED;
|
||||
|
||||
KeReleaseSpinLock(&Connection->Lock, OldIrql);
|
||||
|
||||
while ((Entry = ExInterlockedRemoveHeadList( &Connection->ReceiveRequest,
|
||||
&Connection->Lock )) != NULL)
|
||||
{
|
||||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
|
||||
Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 );
|
||||
Complete( Bucket->Request.RequestContext, SocketError, 0 );
|
||||
|
||||
exFreePool(Bucket);
|
||||
}
|
||||
|
@ -64,7 +76,7 @@ static VOID DrainSignals() {
|
|||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
|
||||
Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 );
|
||||
Complete( Bucket->Request.RequestContext, SocketError, 0 );
|
||||
|
||||
exFreePool(Bucket);
|
||||
}
|
||||
|
@ -75,7 +87,7 @@ static VOID DrainSignals() {
|
|||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
|
||||
Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 );
|
||||
Complete( Bucket->Request.RequestContext, SocketError, 0 );
|
||||
|
||||
exFreePool(Bucket);
|
||||
}
|
||||
|
@ -86,7 +98,7 @@ static VOID DrainSignals() {
|
|||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||
Complete = Bucket->Request.RequestNotifyObject;
|
||||
|
||||
Complete( Bucket->Request.RequestContext, STATUS_CANCELLED, 0 );
|
||||
Complete( Bucket->Request.RequestContext, SocketError, 0 );
|
||||
|
||||
exFreePool(Bucket);
|
||||
}
|
||||
|
@ -573,8 +585,9 @@ NTSTATUS TCPTranslateError( int OskitError ) {
|
|||
case 0: Status = STATUS_SUCCESS; break;
|
||||
case OSK_EADDRNOTAVAIL: Status = STATUS_INVALID_ADDRESS; break;
|
||||
case OSK_EAFNOSUPPORT: Status = STATUS_INVALID_CONNECTION; break;
|
||||
case OSK_ECONNREFUSED:
|
||||
case OSK_ECONNRESET: Status = STATUS_REMOTE_NOT_LISTENING; break;
|
||||
case OSK_ECONNREFUSED: Status = STATUS_REMOTE_NOT_LISTENING; break;
|
||||
case OSK_ECONNRESET:
|
||||
case OSK_ECONNABORTED: Status = STATUS_REMOTE_DISCONNECT; break;
|
||||
case OSK_EWOULDBLOCK:
|
||||
case OSK_EINPROGRESS: Status = STATUS_PENDING; break;
|
||||
case OSK_EINVAL: Status = STATUS_INVALID_PARAMETER; break;
|
||||
|
|
|
@ -164,6 +164,8 @@ int OskitTCPSetSockOpt(void *socket,
|
|||
|
||||
int OskitTCPDisconnect(void *socket);
|
||||
|
||||
int OskitTCPGetSocketError(void *socket);
|
||||
|
||||
#undef errno
|
||||
|
||||
void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... );
|
||||
|
|
|
@ -595,6 +595,20 @@ int OskitTCPGetAddress( void *socket,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int OskitTCPGetSocketError(void *socket) {
|
||||
struct socket *so = socket;
|
||||
int error;
|
||||
|
||||
if (!socket)
|
||||
return OSK_ESHUTDOWN;
|
||||
|
||||
OSKLock();
|
||||
error = so->so_error;
|
||||
OSKUnlock();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
struct ifaddr *ifa_iffind(struct sockaddr *addr, int type)
|
||||
{
|
||||
if( OtcpEvent.FindInterface )
|
||||
|
|
Loading…
Reference in a new issue