mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[AFD]
- Launch a new listen IRP right after the current one completes instead of waiting until the current pending connection is accepted - Reduces the chance of AFD missing two connection requests that are issued very close together and increases network performance by allowing our connection queue to do its job svn path=/trunk/; revision=52013
This commit is contained in:
parent
4e0877c6fb
commit
e26e8e7106
4 changed files with 25 additions and 57 deletions
|
@ -178,18 +178,31 @@ static NTSTATUS NTAPI ListenComplete
|
|||
ListEntry ) );
|
||||
}
|
||||
|
||||
if( FCB->ListenIrp.ConnectionCallInfo ) {
|
||||
ExFreePool( FCB->ListenIrp.ConnectionCallInfo );
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
}
|
||||
/* Launch new accept socket */
|
||||
Status = WarmSocketForConnection( FCB );
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType);
|
||||
ASSERT(Status == STATUS_SUCCESS);
|
||||
|
||||
Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType);
|
||||
ASSERT(Status == STATUS_SUCCESS);
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
&FCB->ListenIrp.ConnectionCallInfo,
|
||||
&FCB->ListenIrp.ConnectionReturnInfo,
|
||||
&FCB->ListenIrp.Iosb,
|
||||
ListenComplete,
|
||||
FCB );
|
||||
|
||||
if( FCB->ListenIrp.ConnectionReturnInfo ) {
|
||||
ExFreePool( FCB->ListenIrp.ConnectionReturnInfo );
|
||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
||||
if (Status == STATUS_PENDING)
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
FCB->NeedsNewListen = TRUE;
|
||||
|
||||
/* Trigger a select return if appropriate */
|
||||
if( !IsListEmpty( &FCB->PendingConnections ) ) {
|
||||
FCB->PollState |= AFD_EVENT_ACCEPT;
|
||||
|
@ -264,9 +277,6 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
if( Status == STATUS_PENDING )
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
FCB->NeedsNewListen = FALSE;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
@ -323,48 +333,6 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
|
||||
|
||||
if( FCB->NeedsNewListen ) {
|
||||
AFD_DbgPrint(MID_TRACE,("ADDRESSFILE: %x\n", FCB->AddressFile.Handle));
|
||||
|
||||
/* Launch new accept socket */
|
||||
Status = WarmSocketForConnection( FCB );
|
||||
|
||||
if( Status == STATUS_SUCCESS ) {
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionCallInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
|
||||
Status = TdiBuildNullConnectionInfo
|
||||
( &FCB->ListenIrp.ConnectionReturnInfo,
|
||||
FCB->LocalAddress->Address[0].AddressType );
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePool(FCB->ListenIrp.ConnectionCallInfo);
|
||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
||||
return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
|
||||
}
|
||||
|
||||
Status = TdiListen( &FCB->ListenIrp.InFlightRequest,
|
||||
FCB->Connection.Object,
|
||||
&FCB->ListenIrp.ConnectionCallInfo,
|
||||
&FCB->ListenIrp.ConnectionReturnInfo,
|
||||
&FCB->ListenIrp.Iosb,
|
||||
ListenComplete,
|
||||
FCB );
|
||||
|
||||
if( Status == STATUS_PENDING )
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
|
||||
FCB->NeedsNewListen = FALSE;
|
||||
} else return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||
}
|
||||
|
||||
for( PendingConn = FCB->PendingConnections.Flink;
|
||||
PendingConn != &FCB->PendingConnections;
|
||||
PendingConn = PendingConn->Flink ) {
|
||||
|
|
|
@ -77,7 +77,7 @@ PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ) {
|
|||
return A;
|
||||
}
|
||||
|
||||
static NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||
NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo,
|
||||
ULONG Type )
|
||||
/*
|
||||
|
|
|
@ -179,7 +179,7 @@ typedef struct _AFD_FCB {
|
|||
PVOID CurrentThread;
|
||||
PFILE_OBJECT FileObject;
|
||||
PAFD_DEVICE_EXTENSION DeviceExt;
|
||||
BOOLEAN DelayedAccept, NeedsNewListen;
|
||||
BOOLEAN DelayedAccept;
|
||||
UINT ConnSeq;
|
||||
PTRANSPORT_ADDRESS LocalAddress, RemoteAddress;
|
||||
PTDI_CONNECTION_INFORMATION AddressFrom, ConnectInfo;
|
||||
|
|
|
@ -19,7 +19,7 @@ NTSTATUS TdiBuildConnectionInfoInPlace
|
|||
( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name );
|
||||
NTSTATUS TdiBuildConnectionInfo
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name );
|
||||
NTSTATUS TdiBuildNullConnectionInfoToPlace
|
||||
NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
||||
NTSTATUS TdiBuildNullConnectionInfo
|
||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
||||
|
|
Loading…
Reference in a new issue