mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +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
|
@ -178,17 +178,30 @@ static NTSTATUS NTAPI ListenComplete
|
||||||
ListEntry ) );
|
ListEntry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FCB->ListenIrp.ConnectionCallInfo ) {
|
/* Launch new accept socket */
|
||||||
ExFreePool( FCB->ListenIrp.ConnectionCallInfo );
|
Status = WarmSocketForConnection( FCB );
|
||||||
FCB->ListenIrp.ConnectionCallInfo = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( FCB->ListenIrp.ConnectionReturnInfo ) {
|
if (NT_SUCCESS(Status))
|
||||||
ExFreePool( FCB->ListenIrp.ConnectionReturnInfo );
|
{
|
||||||
FCB->ListenIrp.ConnectionReturnInfo = NULL;
|
Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionCallInfo,
|
||||||
}
|
FCB->LocalAddress->Address[0].AddressType);
|
||||||
|
ASSERT(Status == STATUS_SUCCESS);
|
||||||
|
|
||||||
FCB->NeedsNewListen = TRUE;
|
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 (Status == STATUS_PENDING)
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Trigger a select return if appropriate */
|
/* Trigger a select return if appropriate */
|
||||||
if( !IsListEmpty( &FCB->PendingConnections ) ) {
|
if( !IsListEmpty( &FCB->PendingConnections ) ) {
|
||||||
|
@ -264,9 +277,6 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
if( Status == STATUS_PENDING )
|
if( Status == STATUS_PENDING )
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
FCB->NeedsNewListen = FALSE;
|
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||||
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
|
||||||
}
|
}
|
||||||
|
@ -323,48 +333,6 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
|
|
||||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( 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;
|
for( PendingConn = FCB->PendingConnections.Flink;
|
||||||
PendingConn != &FCB->PendingConnections;
|
PendingConn != &FCB->PendingConnections;
|
||||||
PendingConn = PendingConn->Flink ) {
|
PendingConn = PendingConn->Flink ) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ) {
|
||||||
return A;
|
return A;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS TdiBuildNullConnectionInfoInPlace
|
NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnInfo,
|
( PTDI_CONNECTION_INFORMATION ConnInfo,
|
||||||
ULONG Type )
|
ULONG Type )
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -179,7 +179,7 @@ typedef struct _AFD_FCB {
|
||||||
PVOID CurrentThread;
|
PVOID CurrentThread;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
PAFD_DEVICE_EXTENSION DeviceExt;
|
PAFD_DEVICE_EXTENSION DeviceExt;
|
||||||
BOOLEAN DelayedAccept, NeedsNewListen;
|
BOOLEAN DelayedAccept;
|
||||||
UINT ConnSeq;
|
UINT ConnSeq;
|
||||||
PTRANSPORT_ADDRESS LocalAddress, RemoteAddress;
|
PTRANSPORT_ADDRESS LocalAddress, RemoteAddress;
|
||||||
PTDI_CONNECTION_INFORMATION AddressFrom, ConnectInfo;
|
PTDI_CONNECTION_INFORMATION AddressFrom, ConnectInfo;
|
||||||
|
|
|
@ -19,7 +19,7 @@ NTSTATUS TdiBuildConnectionInfoInPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name );
|
( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name );
|
||||||
NTSTATUS TdiBuildConnectionInfo
|
NTSTATUS TdiBuildConnectionInfo
|
||||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name );
|
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name );
|
||||||
NTSTATUS TdiBuildNullConnectionInfoToPlace
|
NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||||
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type );
|
||||||
NTSTATUS TdiBuildNullConnectionInfo
|
NTSTATUS TdiBuildNullConnectionInfo
|
||||||
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type );
|
||||||
|
|
Loading…
Reference in a new issue