Use lookaside lists for two most common allocation sizes (mbuf and data buffer)
[reactos.git] / reactos / drivers / lib / ip / transport / tcp / tcp.c
index 8846ef8..cfa5aa6 100644 (file)
@@ -286,10 +286,12 @@ POSK_IFADDR TCPFindInterface( void *ClientData,
                              OSK_UINT FindType,
                              OSK_SOCKADDR *ReqAddr );
 
+NTSTATUS TCPMemStartup( void );
 void *TCPMalloc( void *ClientData,
                 OSK_UINT bytes, OSK_PCHAR file, OSK_UINT line );
 void TCPFree( void *ClientData,
              void *data, OSK_PCHAR file, OSK_UINT line );
+void TCPMemShutdown( void );
 
 int TCPSleep( void *ClientData, void *token, int priority, char *msg,
              int tmio );
@@ -376,10 +378,16 @@ NTSTATUS TCPStartup(VOID)
  *     Status of operation
  */
 {
+    NTSTATUS Status;
+
     TcpipRecursiveMutexInit( &TCPLock );
     ExInitializeFastMutex( &SleepingThreadsLock );
     InitializeListHead( &SleepingThreadsList );
     InitializeListHead( &SignalledConnections );
+    Status = TCPMemStartup();
+    if ( ! NT_SUCCESS(Status) ) {
+       return Status;
+    }
 
     PortsStartup( &TCPPorts, 1, 0xfffe );
 
@@ -433,6 +441,8 @@ NTSTATUS TCPShutdown(VOID)
 
     PortsShutdown( &TCPPorts );
 
+    TCPMemShutdown();
+
     return STATUS_SUCCESS;
 }