Commit in reactos/drivers/net/afd/afd on arty_afd_20040709
connect.c+21-31.1.2.1 -> 1.1.2.2
write.c+10-11.1.2.1 -> 1.1.2.2
+31-4
2 modified files
Fixed socket status around connect.  I should revisit this to make sure that
blocking is done in the right places and not done in others.

reactos/drivers/net/afd/afd
connect.c 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- connect.c	9 Jul 2004 04:41:18 -0000	1.1.2.1
+++ connect.c	11 Jul 2004 23:04:34 -0000	1.1.2.2
@@ -1,4 +1,4 @@
-/* $Id: connect.c,v 1.1.2.1 2004/07/09 04:41:18 arty Exp $
+/* $Id: connect.c,v 1.1.2.2 2004/07/11 23:04:34 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/connect.c
@@ -51,12 +51,17 @@
      * not need to relock. */
     /* if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); */
 
+    AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n", 
+			    Irp->IoStatus.Status));
+
     if( NT_SUCCESS(Irp->IoStatus.Status) ) {
 	FCB->PollState |= AFD_EVENT_CONNECT;
 	FCB->State = SOCKET_STATE_CONNECTED;
+	AFD_DbgPrint(MID_TRACE,("Going to connected state %d\n", FCB->State));
 	PollReeval( FCB->DeviceExt, FCB->FileObject );
     } else {
 	FCB->PollState |= AFD_EVENT_CONNECT_FAIL;
+	AFD_DbgPrint(MID_TRACE,("Going to bound state\n"));
 	FCB->State = SOCKET_STATE_BOUND;
 	PollReeval( FCB->DeviceExt, FCB->FileObject );
     }
@@ -89,6 +94,19 @@
 				 FCB );
 	}
 
+	if( FCB->Send.Window && 
+	    !IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) ) {
+	    NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]);
+	    NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, 
+					Tail.Overlay.ListEntry);
+	    AFD_DbgPrint(MID_TRACE,("Launching send request %x\n", NextIrp));
+	    Status = AfdConnectedSocketWriteData
+		( DeviceObject,
+		  NextIrp,
+		  IoGetCurrentIrpStackLocation( NextIrp ),
+		  FALSE );
+	}
+
 	if( Status == STATUS_PENDING )
 	    Status = STATUS_SUCCESS;
     }
@@ -155,6 +173,8 @@
 	FCB->RemoteAddress = TaCopyTransportAddress( &ConnectReq->Address );
 	
 	Status = WarmSocketForConnection( FCB );
+
+	FCB->State = SOCKET_STATE_CONNECTING;
 	
 	if( NT_SUCCESS(Status) ) {
 	    Status = TdiConnect( &FCB->PendingTdiIrp, 
@@ -163,8 +183,6 @@
 				 StreamSocketConnectComplete,
 				 FCB );
 	}
-	
-	FCB->State = SOCKET_STATE_CONNECTING;
 	break;
 
     default:

reactos/drivers/net/afd/afd
write.c 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- write.c	9 Jul 2004 04:41:18 -0000	1.1.2.1
+++ write.c	11 Jul 2004 23:04:35 -0000	1.1.2.2
@@ -1,4 +1,4 @@
-/* $Id: write.c,v 1.1.2.1 2004/07/09 04:41:18 arty Exp $
+/* $Id: write.c,v 1.1.2.2 2004/07/11 23:04:35 arty Exp $
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * FILE:             drivers/net/afd/afd/write.c
@@ -144,6 +144,13 @@
 
     if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
 
+    AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State));
+
+    if( FCB->State != SOCKET_STATE_CONNECTED ) {
+	AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
+	return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
+    }
+
     AFD_DbgPrint(MID_TRACE,("We already have %d bytes waiting.\n", 
 			    FCB->Send.BytesUsed));
 
@@ -151,6 +158,8 @@
 					SendReq->BufferCount,
 					FALSE );
     
+    AFD_DbgPrint(MID_TRACE,("FCB->Send.BytesUsed = %d\n", FCB->Send.BytesUsed));
+
     if( !FCB->Send.BytesUsed ) {
 	SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed;
 
CVSspam 0.2.8