Author: cgutman
Date: Tue Oct 21 19:53:00 2008
New Revision: 36884
URL:
http://svn.reactos.org/svn/reactos?rev=36884&view=rev
Log:
- Add and broaden some locks
- Pass BytesSent to DispDataRequestComplete
Modified:
branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c
Modified: branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Tue
Oct 21 19:53:00 2008
@@ -384,6 +384,8 @@
/* Get associated connection endpoint file object. Quit if none exists */
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+
TranContext = IrpSp->FileObject->FsContext;
if (!TranContext) {
TI_DbgPrint(MID_TRACE, ("Bad transport context.\n"));
@@ -412,6 +414,8 @@
DispDataRequestComplete(Irp, Status, 0);
} else
IoMarkIrpPending(Irp);
+
+ TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(MAX_TRACE, ("TCP Connect returned %08x\n", Status));
@@ -530,6 +534,8 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
/* Get associated connection endpoint file object. Quit if none exists */
+
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
TranContext = IrpSp->FileObject->FsContext;
if (TranContext == NULL)
@@ -603,6 +609,8 @@
DispDataRequestComplete(Irp, Status, 0);
} else
IoMarkIrpPending(Irp);
+
+ TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(MID_TRACE,("Leaving %x\n", Status));
@@ -754,6 +762,8 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
ReceiveInfo = (PTDI_REQUEST_KERNEL_RECEIVE)&(IrpSp->Parameters);
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+
TranContext = IrpSp->FileObject->FsContext;
if (TranContext == NULL)
{
@@ -778,9 +788,6 @@
TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n",
Irp->MdlAddress));
if (NT_SUCCESS(Status))
{
- /* Lock here so we're sure we've got the following 'mark pending'
*/
- TcpipRecursiveMutexEnter( &TCPLock, TRUE );
-
Status = TCPReceiveData(
TranContext->Handle.ConnectionContext,
(PNDIS_BUFFER)Irp->MdlAddress,
@@ -789,8 +796,6 @@
ReceiveInfo->ReceiveFlags,
DispDataRequestComplete,
Irp);
-
- TcpipRecursiveMutexLeave( &TCPLock );
}
done:
@@ -798,6 +803,8 @@
DispDataRequestComplete(Irp, Status, BytesReceived);
} else
IoMarkIrpPending(Irp);
+
+ TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
@@ -826,6 +833,8 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
DgramInfo = (PTDI_REQUEST_KERNEL_RECEIVEDG)&(IrpSp->Parameters);
+
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
TranContext = IrpSp->FileObject->FsContext;
if (TranContext == NULL)
@@ -873,6 +882,8 @@
} else
IoMarkIrpPending(Irp);
+ TcpipRecursiveMutexLeave( &TCPLock );
+
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
return Status;
@@ -899,6 +910,8 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
SendInfo = (PTDI_REQUEST_KERNEL_SEND)&(IrpSp->Parameters);
+
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
TranContext = IrpSp->FileObject->FsContext;
if (TranContext == NULL)
@@ -941,9 +954,11 @@
done:
if (Status != STATUS_PENDING) {
- DispDataRequestComplete(Irp, Status, 0);
+ DispDataRequestComplete(Irp, Status, BytesSent);
} else
IoMarkIrpPending(Irp);
+
+ TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));
@@ -971,6 +986,9 @@
IrpSp = IoGetCurrentIrpStackLocation(Irp);
DgramInfo = (PTDI_REQUEST_KERNEL_SENDDG)&(IrpSp->Parameters);
+
+ TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+
TranContext = IrpSp->FileObject->FsContext;
if (TranContext == NULL)
{
@@ -1021,6 +1039,8 @@
DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information);
} else
IoMarkIrpPending(Irp);
+
+ TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(DEBUG_IRP, ("Leaving.\n"));