Author: cgutman
Date: Mon May 30 17:27:53 2011
New Revision: 52013
URL:
http://svn.reactos.org/svn/reactos?rev=52013&view=rev
Log:
[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
Modified:
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/tdiconn.c
trunk/reactos/drivers/network/afd/include/afd.h
trunk/reactos/drivers/network/afd/include/tdiconn.h
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Mon May 30 17:27:53 2011
@@ -178,17 +178,30 @@
ListEntry ) );
}
- if( FCB->ListenIrp.ConnectionCallInfo ) {
- ExFreePool( FCB->ListenIrp.ConnectionCallInfo );
- FCB->ListenIrp.ConnectionCallInfo = NULL;
- }
-
- if( FCB->ListenIrp.ConnectionReturnInfo ) {
- ExFreePool( FCB->ListenIrp.ConnectionReturnInfo );
- FCB->ListenIrp.ConnectionReturnInfo = NULL;
- }
-
- FCB->NeedsNewListen = TRUE;
+ /* 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 (Status == STATUS_PENDING)
+ Status = STATUS_SUCCESS;
+ }
/* Trigger a select return if appropriate */
if( !IsListEmpty( &FCB->PendingConnections ) ) {
@@ -263,9 +276,6 @@
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 @@
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 ) {
Modified: trunk/reactos/drivers/network/afd/afd/tdiconn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/tdiconn.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/tdiconn.c [iso-8859-1] Mon May 30 17:27:53 2011
@@ -77,7 +77,7 @@
return A;
}
-static NTSTATUS TdiBuildNullConnectionInfoInPlace
+NTSTATUS TdiBuildNullConnectionInfoInPlace
( PTDI_CONNECTION_INFORMATION ConnInfo,
ULONG Type )
/*
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon May 30 17:27:53 2011
@@ -179,7 +179,7 @@
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;
Modified: trunk/reactos/drivers/network/afd/include/tdiconn.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/tdiconn.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/tdiconn.h [iso-8859-1] Mon May 30 17:27:53
2011
@@ -19,7 +19,7 @@
( 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 );