From 91fea9194d3365bf4fc150da7015076e2bfd1091 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sat, 25 Sep 2004 20:38:46 +0000 Subject: [PATCH] Previously checked in with some detritus from some experimental rtl stuff. Fixed. svn path=/trunk/; revision=11052 --- reactos/drivers/net/tcpip/include/precomp.h | 1 - reactos/drivers/net/tcpip/transport/tcp/tcp.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/net/tcpip/include/precomp.h b/reactos/drivers/net/tcpip/include/precomp.h index 147673cfb47..8532a9ff6e5 100644 --- a/reactos/drivers/net/tcpip/include/precomp.h +++ b/reactos/drivers/net/tcpip/include/precomp.h @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff --git a/reactos/drivers/net/tcpip/transport/tcp/tcp.c b/reactos/drivers/net/tcpip/transport/tcp/tcp.c index 7c1eae4165d..67d26138449 100644 --- a/reactos/drivers/net/tcpip/transport/tcp/tcp.c +++ b/reactos/drivers/net/tcpip/transport/tcp/tcp.c @@ -15,7 +15,7 @@ static BOOLEAN TCPInitialized = FALSE; static NPAGED_LOOKASIDE_LIST TCPSegmentList; LIST_ENTRY SleepingThreadsList; FAST_MUTEX SleepingThreadsLock; -RECURSIVE_MUTEX TcpMutex; +FAST_MUTEX TCPLock; VOID TCPReceive(PNET_TABLE_ENTRY NTE, PIP_PACKET IPPacket) /* @@ -31,9 +31,13 @@ VOID TCPReceive(PNET_TABLE_ENTRY NTE, PIP_PACKET IPPacket) IPPacket->TotalSize, IPPacket->HeaderSize)); + ExAcquireFastMutex( &TCPLock ); + OskitTCPReceiveDatagram( IPPacket->Header, IPPacket->TotalSize, IPPacket->HeaderSize ); + + ExReleaseFastMutex( &TCPLock ); } /* event.c */ @@ -79,6 +83,7 @@ NTSTATUS TCPStartup(VOID) * Status of operation */ { + ExInitializeFastMutex( &TCPLock ); ExInitializeFastMutex( &SleepingThreadsLock ); InitializeListHead( &SleepingThreadsList ); @@ -194,6 +199,7 @@ NTSTATUS TCPConnect Bucket = ExAllocatePool( NonPagedPool, sizeof(*Bucket) ); if( !Bucket ) return STATUS_NO_MEMORY; + ExAcquireFastMutex( &TCPLock ); KeAcquireSpinLock(&Connection->Lock, &OldIrql); /* Freed in TCPSocketState */ @@ -234,6 +240,7 @@ NTSTATUS TCPConnect sizeof(AddressToConnect)); KeReleaseSpinLock(&Connection->Lock, OldIrql); + ExReleaseFastMutex( &TCPLock ); if( Status == OSK_EINPROGRESS || Status == STATUS_SUCCESS ) return STATUS_PENDING; @@ -250,11 +257,13 @@ NTSTATUS TCPClose TI_DbgPrint(MID_TRACE,("TCPClose started\n")); + ExAcquireFastMutex( &TCPLock ); KeAcquireSpinLock(&Connection->Lock, &OldIrql); Status = TCPTranslateError( OskitTCPClose( Connection->SocketContext ) ); KeReleaseSpinLock(&Connection->Lock, OldIrql); + ExReleaseFastMutex( &TCPLock ); TI_DbgPrint(MID_TRACE,("TCPClose finished %x\n", Status)); @@ -270,12 +279,14 @@ NTSTATUS TCPListen Connection = Request->Handle.ConnectionContext; + ExAcquireFastMutex( &TCPLock ); KeAcquireSpinLock(&Connection->Lock, &OldIrql); Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) ); KeReleaseSpinLock(&Connection->Lock, OldIrql); + ExReleaseFastMutex( &TCPLock ); return Status; } @@ -303,6 +314,7 @@ NTSTATUS TCPReceiveData Connection = Request->Handle.ConnectionContext; + ExAcquireFastMutex( &TCPLock ); KeAcquireSpinLock(&Connection->Lock, &OldIrql); NdisQueryBuffer( Buffer, &DataBuffer, &DataLen ); @@ -340,6 +352,7 @@ NTSTATUS TCPReceiveData } KeReleaseSpinLock(&Connection->Lock, OldIrql); + ExReleaseFastMutex( &TCPLock ); TI_DbgPrint(MID_TRACE,("Status %x\n", Status)); @@ -360,6 +373,7 @@ NTSTATUS TCPSendData Connection = Request->Handle.ConnectionContext; + ExAcquireFastMutex( &TCPLock ); KeAcquireSpinLock(&Connection->Lock, &OldIrql); NdisQueryBuffer( Buffer, &BufferData, &PacketSize ); @@ -374,6 +388,7 @@ NTSTATUS TCPSendData BufferData, PacketSize, (PUINT)DataUsed, 0 ); KeReleaseSpinLock(&Connection->Lock, OldIrql); + ExReleaseFastMutex( &TCPLock ); return Status; } @@ -381,7 +396,9 @@ NTSTATUS TCPSendData VOID TCPTimeout(VOID) { static int Times = 0; if( (Times++ % 5) == 0 ) { + ExAcquireFastMutex( &TCPLock ); TimerOskitTCP(); + ExReleaseFastMutex( &TCPLock ); } }