- Remove TCPSleep and TCPWakeup (we make all oskittcp sockets non-blocking)
authorCameron Gutman <aicommander@gmail.com>
Sat, 7 Nov 2009 18:12:58 +0000 (18:12 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 7 Nov 2009 18:12:58 +0000 (18:12 +0000)
 - Crash ROS better in oskittcp_die

svn path=/trunk/; revision=44010

reactos/lib/drivers/ip/transport/tcp/event.c
reactos/lib/drivers/ip/transport/tcp/tcp.c
reactos/lib/drivers/oskittcp/oskittcp/interface.c

index ee55ce9..c4c88a7 100644 (file)
@@ -123,74 +123,6 @@ int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) {
     return 0;
 }
 
-int TCPSleep( void *ClientData, void *token, int priority, char *msg,
-          int tmio ) {
-    PSLEEPING_THREAD SleepingThread;
-    LARGE_INTEGER Timeout;
-
-    ASSERT_LOCKED(&TCPLock);
-
-    TI_DbgPrint(DEBUG_TCP,
-        ("Called TSLEEP: tok = %x, pri = %d, wmesg = %s, tmio = %x\n",
-         token, priority, msg, tmio));
-
-    SleepingThread = exAllocatePool( NonPagedPool, sizeof( *SleepingThread ) );
-    if( SleepingThread ) {
-    KeInitializeEvent( &SleepingThread->Event, NotificationEvent, FALSE );
-    SleepingThread->SleepToken = token;
-
-    /* We're going to sleep and need to release the lock, otherwise
-           it's impossible to re-enter oskittcp to deliver the event that's
-           going to wake us */
-    TcpipRecursiveMutexLeave( &TCPLock );
-
-    TcpipAcquireFastMutex( &SleepingThreadsLock );
-    InsertTailList( &SleepingThreadsList, &SleepingThread->Entry );
-    TcpipReleaseFastMutex( &SleepingThreadsLock );
-
-        Timeout.QuadPart = Int32x32To64(tmio, -10000);
-
-    TI_DbgPrint(DEBUG_TCP,("Waiting on %x\n", token));
-    KeWaitForSingleObject( &SleepingThread->Event,
-                   Executive,
-                   KernelMode,
-                   TRUE,
-                   (tmio != 0) ? &Timeout : NULL );
-
-    TcpipAcquireFastMutex( &SleepingThreadsLock );
-    RemoveEntryList( &SleepingThread->Entry );
-    TcpipReleaseFastMutex( &SleepingThreadsLock );
-
-    TcpipRecursiveMutexEnter( &TCPLock, TRUE );
-
-    exFreePool( SleepingThread );
-    } else
-        return OSK_ENOBUFS;
-
-    TI_DbgPrint(DEBUG_TCP,("Waiting finished: %x\n", token));
-    return 0;
-}
-
-void TCPWakeup( void *ClientData, void *token ) {
-    PLIST_ENTRY Entry;
-    PSLEEPING_THREAD SleepingThread;
-
-    ASSERT_LOCKED(&TCPLock);
-
-    TcpipAcquireFastMutex( &SleepingThreadsLock );
-    Entry = SleepingThreadsList.Flink;
-    while( Entry != &SleepingThreadsList ) {
-    SleepingThread = CONTAINING_RECORD(Entry, SLEEPING_THREAD, Entry);
-    TI_DbgPrint(DEBUG_TCP,("Sleeper @ %x\n", SleepingThread));
-    if( SleepingThread->SleepToken == token ) {
-        TI_DbgPrint(DEBUG_TCP,("Setting event to wake %x\n", token));
-        KeSetEvent( &SleepingThread->Event, IO_NETWORK_INCREMENT, FALSE );
-    }
-    Entry = Entry->Flink;
-    }
-    TcpipReleaseFastMutex( &SleepingThreadsLock );
-}
-
 /* Memory management routines
  *
  * By far the most requests for memory are either for 128 or 2048 byte blocks,
index 1641718..d256e89 100644 (file)
@@ -17,8 +17,6 @@ static BOOLEAN TCPInitialized = FALSE;
 static NPAGED_LOOKASIDE_LIST TCPSegmentList;
 LIST_ENTRY SignalledConnectionsList;
 KSPIN_LOCK SignalledConnectionsLock;
-LIST_ENTRY SleepingThreadsList;
-FAST_MUTEX SleepingThreadsLock;
 RECURSIVE_MUTEX TCPLock;
 PORT_SET TCPPorts;
 
@@ -403,11 +401,6 @@ 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 );
-
-void TCPWakeup( void *ClientData, void *token );
-
 OSKITTCP_EVENT_HANDLERS EventHandlers = {
     NULL,             /* Client Data */
     TCPSocketState,   /* SocketState */
@@ -415,8 +408,8 @@ OSKITTCP_EVENT_HANDLERS EventHandlers = {
     TCPFindInterface, /* FindInterface */
     TCPMalloc,        /* Malloc */
     TCPFree,          /* Free */
-    TCPSleep,         /* Sleep */
-    TCPWakeup         /* Wakeup */
+    NULL,             /* Sleep */
+    NULL,             /* Wakeup */
 };
 
 static KEVENT TimerLoopEvent;
@@ -490,9 +483,7 @@ NTSTATUS TCPStartup(VOID)
     NTSTATUS Status;
 
     TcpipRecursiveMutexInit( &TCPLock );
-    ExInitializeFastMutex( &SleepingThreadsLock );
     KeInitializeSpinLock( &SignalledConnectionsLock );
-    InitializeListHead( &SleepingThreadsList );
     InitializeListHead( &SignalledConnectionsList );
     Status = TCPMemStartup();
     if ( ! NT_SUCCESS(Status) ) {
index a1d3e89..5aea3dd 100644 (file)
@@ -566,7 +566,7 @@ struct ifaddr *ifa_iffind(struct sockaddr *addr, int type)
 
 void oskittcp_die( const char *file, int line ) {
     DbgPrint("\n\n*** OSKITTCP: Panic Called at %s:%d ***\n", file, line);
-    *((int *)0) = 0;
+    ASSERT(FALSE);
 }
 
 /* Stuff supporting the BSD network-interface interface */