mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
connect: Allow async connections, and assume that concurrent operations
(like write) can happen. main: Allow empty EaInfo in open, re: async select and the special control socket. read + write: assertions tdi: don't wait for connect to return, remove event. svn path=/trunk/; revision=11876
This commit is contained in:
parent
38ac0afdbb
commit
6b4f09638b
5 changed files with 54 additions and 49 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: connect.c,v 1.5 2004/11/21 20:54:52 arty Exp $
|
||||
/* $Id: connect.c,v 1.6 2004/11/30 04:49:50 arty Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/connect.c
|
||||
|
@ -53,10 +53,9 @@ NTSTATUS DDKAPI StreamSocketConnectComplete
|
|||
AFD_DbgPrint(MID_TRACE,("Called: FCB %x, FO %x\n",
|
||||
Context, FCB->FileObject));
|
||||
|
||||
/* Check the result of the connect operation */
|
||||
/* Since the previous does not return until we come through here, we do
|
||||
* not need to relock. */
|
||||
/* if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); */
|
||||
/* I was wrong about this before as we can have pending writes to a not
|
||||
* yet connected socket */
|
||||
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n",
|
||||
Irp->IoStatus.Status));
|
||||
|
@ -118,7 +117,7 @@ NTSTATUS DDKAPI StreamSocketConnectComplete
|
|||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* SocketStateUnlock( FCB ); */
|
||||
SocketStateUnlock( FCB );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||
|
||||
|
@ -202,6 +201,10 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
FCB );
|
||||
|
||||
ExFreePool( TargetAddress );
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp));
|
||||
|
||||
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
|
||||
} else Status = STATUS_NO_MEMORY;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: main.c,v 1.13 2004/11/21 20:54:52 arty Exp $
|
||||
/* $Id: main.c,v 1.14 2004/11/30 04:49:50 arty Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/main.c
|
||||
|
@ -47,9 +47,9 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
PFILE_OBJECT FileObject;
|
||||
PAFD_DEVICE_EXTENSION DeviceExt;
|
||||
PFILE_FULL_EA_INFORMATION EaInfo;
|
||||
PAFD_CREATE_PACKET ConnectInfo;
|
||||
PAFD_CREATE_PACKET ConnectInfo = NULL;
|
||||
ULONG EaLength;
|
||||
PWCHAR EaInfoValue;
|
||||
PWCHAR EaInfoValue = NULL;
|
||||
UINT Disposition, i;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,
|
||||
|
@ -62,22 +62,18 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
Irp->IoStatus.Information = 0;
|
||||
|
||||
EaInfo = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
if( EaInfo ) {
|
||||
ConnectInfo = (PAFD_CREATE_PACKET)(EaInfo->EaName + EaInfo->EaNameLength + 1);
|
||||
EaInfoValue = (PWCHAR)(((PCHAR)ConnectInfo) + sizeof(AFD_CREATE_PACKET));
|
||||
|
||||
if(!EaInfo) {
|
||||
AFD_DbgPrint(MIN_TRACE, ("No EA Info in IRP.\n"));
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
IoCompleteRequest( Irp, IO_NO_INCREMENT );
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EaLength = sizeof(FILE_FULL_EA_INFORMATION) +
|
||||
EaInfo->EaNameLength +
|
||||
EaInfo->EaValueLength;
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("EaInfo: %x, EaInfoValue: %x\n",
|
||||
EaInfo, EaInfoValue));
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("About to allocate the new FCB\n"));
|
||||
|
||||
|
@ -88,11 +84,11 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %x (FileObject %x Flags %x)\n", FCB, FileObject, ConnectInfo->EndpointFlags));
|
||||
AFD_DbgPrint(MID_TRACE,("Initializing the new FCB @ %x (FileObject %x Flags %x)\n", FCB, FileObject, ConnectInfo ? ConnectInfo->EndpointFlags : 0));
|
||||
|
||||
RtlZeroMemory( FCB, sizeof( *FCB ) );
|
||||
|
||||
FCB->Flags = ConnectInfo->EndpointFlags;
|
||||
FCB->Flags = ConnectInfo ? ConnectInfo->EndpointFlags : 0;
|
||||
FCB->State = SOCKET_STATE_CREATED;
|
||||
FCB->FileObject = FileObject;
|
||||
FCB->DeviceExt = DeviceExt;
|
||||
|
@ -111,6 +107,7 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("%x: Checking command channel\n", FCB));
|
||||
|
||||
if( ConnectInfo ) {
|
||||
FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
|
||||
FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
|
||||
FCB->TdiDeviceName.Buffer =
|
||||
|
@ -129,6 +126,10 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Success: %s %wZ\n",
|
||||
EaInfo->EaName, &FCB->TdiDeviceName));
|
||||
} else {
|
||||
AFD_DbgPrint(MID_TRACE,("Success: Control connection\n"));
|
||||
}
|
||||
|
||||
FileObject->FsContext = FCB;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: read.c,v 1.12 2004/11/21 20:54:52 arty Exp $
|
||||
/* $Id: read.c,v 1.13 2004/11/30 04:49:50 arty Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/read.c
|
||||
|
@ -79,6 +79,8 @@ NTSTATUS DDKAPI ReceiveComplete
|
|||
|
||||
AFD_DbgPrint(MID_TRACE,("Called\n"));
|
||||
|
||||
ASSERT_IRQL(APC_LEVEL);
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
|
||||
FCB->ReceiveIrp.InFlightRequest = NULL;
|
||||
|
|
|
@ -286,7 +286,6 @@ NTSTATUS TdiConnect(
|
|||
PDEVICE_OBJECT DeviceObject;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
NTSTATUS Status;
|
||||
KEVENT Event;
|
||||
|
||||
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
|
||||
|
||||
|
@ -294,12 +293,10 @@ NTSTATUS TdiConnect(
|
|||
|
||||
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
|
||||
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
|
||||
DeviceObject, /* Device object */
|
||||
ConnectionObject, /* File object */
|
||||
&Event, /* Event */
|
||||
NULL, /* Event */
|
||||
&Iosb); /* Status */
|
||||
if (!*Irp) {
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -314,7 +311,7 @@ NTSTATUS TdiConnect(
|
|||
RemoteAddress, /* Request connection information */
|
||||
RemoteAddress); /* Return connection information */
|
||||
|
||||
Status = TdiCall(*Irp, DeviceObject, &Event, &Iosb);
|
||||
Status = TdiCall(*Irp, DeviceObject, NULL, &Iosb);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: write.c,v 1.12 2004/11/21 20:54:52 arty Exp $
|
||||
/* $Id: write.c,v 1.13 2004/11/30 04:49:50 arty Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/net/afd/afd/write.c
|
||||
|
@ -30,6 +30,8 @@ NTSTATUS DDKAPI SendComplete
|
|||
Irp->IoStatus.Status,
|
||||
Irp->IoStatus.Information));
|
||||
|
||||
ASSERT_IRQL(APC_LEVEL);
|
||||
|
||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||
|
||||
FCB->SendIrp.InFlightRequest = NULL;
|
||||
|
|
Loading…
Reference in a new issue