mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
- Don't forget to store the status in the IRP
- Fix some return statuses svn path=/trunk/; revision=40168
This commit is contained in:
parent
f7374ea760
commit
c999c1eb6e
3 changed files with 54 additions and 11 deletions
|
@ -104,19 +104,27 @@ static NTSTATUS NTAPI ListenComplete
|
|||
PAFD_FCB FCB = (PAFD_FCB)Context;
|
||||
PAFD_TDI_OBJECT_QELT Qelt;
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
FCB->ListenIrp.InFlightRequest = NULL;
|
||||
|
||||
if( Irp->Cancel ) {
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if( FCB->State == SOCKET_STATE_CLOSED ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
DestroySocket( FCB );
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Completing listen request.\n"));
|
||||
|
|
|
@ -235,11 +235,17 @@ NTSTATUS NTAPI ReceiveComplete
|
|||
|
||||
ASSERT_IRQL(APC_LEVEL);
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
FCB->ReceiveIrp.InFlightRequest = NULL;
|
||||
|
||||
if( Irp->Cancel ) {
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
@ -249,11 +255,15 @@ NTSTATUS NTAPI ReceiveComplete
|
|||
|
||||
if( FCB->State == SOCKET_STATE_CLOSED ) {
|
||||
AFD_DbgPrint(MIN_TRACE,("!!! CLOSED SOCK GOT A RECEIVE COMPLETE !!!\n"));
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
DestroySocket( FCB );
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_FILE_CLOSED;
|
||||
} else if( FCB->State == SOCKET_STATE_LISTENING ) {
|
||||
AFD_DbgPrint(MIN_TRACE,("!!! LISTENER GOT A RECEIVE COMPLETE !!!\n"));
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -457,19 +467,27 @@ PacketSocketRecvComplete(
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
FCB->ReceiveIrp.InFlightRequest = NULL;
|
||||
|
||||
if( Irp->Cancel ) {
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if( FCB->State == SOCKET_STATE_CLOSED ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
DestroySocket( FCB );
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
DatagramRecv = ExAllocatePool( NonPagedPool, DGSize );
|
||||
|
@ -488,6 +506,8 @@ PacketSocketRecvComplete(
|
|||
} else Status = STATUS_NO_MEMORY;
|
||||
|
||||
if( !NT_SUCCESS( Status ) ) {
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
if( DatagramRecv ) ExFreePool( DatagramRecv );
|
||||
SocketStateUnlock( FCB );
|
||||
return Status;
|
||||
|
|
|
@ -40,20 +40,28 @@ static NTSTATUS NTAPI SendComplete
|
|||
|
||||
ASSERT_IRQL(APC_LEVEL);
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
FCB->SendIrp.InFlightRequest = NULL;
|
||||
/* Request is not in flight any longer */
|
||||
|
||||
if( Irp->Cancel ) {
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if( FCB->State == SOCKET_STATE_CLOSED ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
DestroySocket( FCB );
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
if( !NT_SUCCESS(Status) ) {
|
||||
|
@ -176,13 +184,18 @@ static NTSTATUS NTAPI PacketSocketSendComplete
|
|||
Irp->IoStatus.Status,
|
||||
Irp->IoStatus.Information));
|
||||
|
||||
/* It's ok if the FCB already died */
|
||||
if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS;
|
||||
if( !SocketAcquireStateLock( FCB ) ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
FCB->SendIrp.InFlightRequest = NULL;
|
||||
/* Request is not in flight any longer */
|
||||
|
||||
if( Irp->Cancel ) {
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
return STATUS_CANCELLED;
|
||||
}
|
||||
|
@ -191,9 +204,11 @@ static NTSTATUS NTAPI PacketSocketSendComplete
|
|||
PollReeval( FCB->DeviceExt, FCB->FileObject );
|
||||
|
||||
if( FCB->State == SOCKET_STATE_CLOSED ) {
|
||||
Irp->IoStatus.Status = STATUS_FILE_CLOSED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
SocketStateUnlock( FCB );
|
||||
DestroySocket( FCB );
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_FILE_CLOSED;
|
||||
}
|
||||
|
||||
SocketStateUnlock( FCB );
|
||||
|
|
Loading…
Reference in a new issue