mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/connect.c
|
* FILE: drivers/net/afd/afd/connect.c
|
||||||
|
@ -53,10 +53,9 @@ NTSTATUS DDKAPI StreamSocketConnectComplete
|
||||||
AFD_DbgPrint(MID_TRACE,("Called: FCB %x, FO %x\n",
|
AFD_DbgPrint(MID_TRACE,("Called: FCB %x, FO %x\n",
|
||||||
Context, FCB->FileObject));
|
Context, FCB->FileObject));
|
||||||
|
|
||||||
/* Check the result of the connect operation */
|
/* I was wrong about this before as we can have pending writes to a not
|
||||||
/* Since the previous does not return until we come through here, we do
|
* yet connected socket */
|
||||||
* not need to relock. */
|
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
|
||||||
/* if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); */
|
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n",
|
AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n",
|
||||||
Irp->IoStatus.Status));
|
Irp->IoStatus.Status));
|
||||||
|
@ -118,7 +117,7 @@ NTSTATUS DDKAPI StreamSocketConnectComplete
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SocketStateUnlock( FCB ); */
|
SocketStateUnlock( FCB );
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
|
||||||
|
|
||||||
|
@ -202,6 +201,10 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
FCB );
|
FCB );
|
||||||
|
|
||||||
ExFreePool( TargetAddress );
|
ExFreePool( TargetAddress );
|
||||||
|
|
||||||
|
AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp));
|
||||||
|
|
||||||
|
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT );
|
||||||
} else Status = STATUS_NO_MEMORY;
|
} else Status = STATUS_NO_MEMORY;
|
||||||
break;
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/main.c
|
* FILE: drivers/net/afd/afd/main.c
|
||||||
|
@ -47,9 +47,9 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
PAFD_DEVICE_EXTENSION DeviceExt;
|
PAFD_DEVICE_EXTENSION DeviceExt;
|
||||||
PFILE_FULL_EA_INFORMATION EaInfo;
|
PFILE_FULL_EA_INFORMATION EaInfo;
|
||||||
PAFD_CREATE_PACKET ConnectInfo;
|
PAFD_CREATE_PACKET ConnectInfo = NULL;
|
||||||
ULONG EaLength;
|
ULONG EaLength;
|
||||||
PWCHAR EaInfoValue;
|
PWCHAR EaInfoValue = NULL;
|
||||||
UINT Disposition, i;
|
UINT Disposition, i;
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,
|
AFD_DbgPrint(MID_TRACE,
|
||||||
|
@ -62,23 +62,19 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
EaInfo = Irp->AssociatedIrp.SystemBuffer;
|
EaInfo = Irp->AssociatedIrp.SystemBuffer;
|
||||||
ConnectInfo = (PAFD_CREATE_PACKET)(EaInfo->EaName + EaInfo->EaNameLength + 1);
|
|
||||||
EaInfoValue = (PWCHAR)(((PCHAR)ConnectInfo) + sizeof(AFD_CREATE_PACKET));
|
|
||||||
|
|
||||||
if(!EaInfo) {
|
if( EaInfo ) {
|
||||||
AFD_DbgPrint(MIN_TRACE, ("No EA Info in IRP.\n"));
|
ConnectInfo = (PAFD_CREATE_PACKET)(EaInfo->EaName + EaInfo->EaNameLength + 1);
|
||||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
EaInfoValue = (PWCHAR)(((PCHAR)ConnectInfo) + sizeof(AFD_CREATE_PACKET));
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
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"));
|
AFD_DbgPrint(MID_TRACE,("About to allocate the new FCB\n"));
|
||||||
|
|
||||||
FCB = ExAllocatePool(NonPagedPool, sizeof(AFD_FCB));
|
FCB = ExAllocatePool(NonPagedPool, sizeof(AFD_FCB));
|
||||||
|
@ -88,11 +84,11 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
return STATUS_NO_MEMORY;
|
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 ) );
|
RtlZeroMemory( FCB, sizeof( *FCB ) );
|
||||||
|
|
||||||
FCB->Flags = ConnectInfo->EndpointFlags;
|
FCB->Flags = ConnectInfo ? ConnectInfo->EndpointFlags : 0;
|
||||||
FCB->State = SOCKET_STATE_CREATED;
|
FCB->State = SOCKET_STATE_CREATED;
|
||||||
FCB->FileObject = FileObject;
|
FCB->FileObject = FileObject;
|
||||||
FCB->DeviceExt = DeviceExt;
|
FCB->DeviceExt = DeviceExt;
|
||||||
|
@ -111,24 +107,29 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("%x: Checking command channel\n", FCB));
|
AFD_DbgPrint(MID_TRACE,("%x: Checking command channel\n", FCB));
|
||||||
|
|
||||||
FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
|
if( ConnectInfo ) {
|
||||||
FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
|
FCB->TdiDeviceName.Length = ConnectInfo->SizeOfTransportName;
|
||||||
FCB->TdiDeviceName.Buffer =
|
FCB->TdiDeviceName.MaximumLength = FCB->TdiDeviceName.Length;
|
||||||
ExAllocatePool( NonPagedPool, FCB->TdiDeviceName.Length );
|
FCB->TdiDeviceName.Buffer =
|
||||||
RtlCopyMemory( FCB->TdiDeviceName.Buffer,
|
ExAllocatePool( NonPagedPool, FCB->TdiDeviceName.Length );
|
||||||
ConnectInfo->TransportName,
|
RtlCopyMemory( FCB->TdiDeviceName.Buffer,
|
||||||
FCB->TdiDeviceName.Length );
|
ConnectInfo->TransportName,
|
||||||
|
FCB->TdiDeviceName.Length );
|
||||||
|
|
||||||
if( !FCB->TdiDeviceName.Buffer ) {
|
if( !FCB->TdiDeviceName.Buffer ) {
|
||||||
ExFreePool(FCB);
|
ExFreePool(FCB);
|
||||||
AFD_DbgPrint(MID_TRACE,("Could not copy target string\n"));
|
AFD_DbgPrint(MID_TRACE,("Could not copy target string\n"));
|
||||||
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
Irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
AFD_DbgPrint(MID_TRACE,("Success: %s %wZ\n",
|
||||||
|
EaInfo->EaName, &FCB->TdiDeviceName));
|
||||||
|
} else {
|
||||||
|
AFD_DbgPrint(MID_TRACE,("Success: Control connection\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Success: %s %wZ\n",
|
|
||||||
EaInfo->EaName, &FCB->TdiDeviceName));
|
|
||||||
FileObject->FsContext = FCB;
|
FileObject->FsContext = FCB;
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/read.c
|
* FILE: drivers/net/afd/afd/read.c
|
||||||
|
@ -79,6 +79,8 @@ NTSTATUS DDKAPI ReceiveComplete
|
||||||
|
|
||||||
AFD_DbgPrint(MID_TRACE,("Called\n"));
|
AFD_DbgPrint(MID_TRACE,("Called\n"));
|
||||||
|
|
||||||
|
ASSERT_IRQL(APC_LEVEL);
|
||||||
|
|
||||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||||
|
|
||||||
FCB->ReceiveIrp.InFlightRequest = NULL;
|
FCB->ReceiveIrp.InFlightRequest = NULL;
|
||||||
|
|
|
@ -286,7 +286,6 @@ NTSTATUS TdiConnect(
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
|
||||||
|
|
||||||
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
|
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
|
||||||
|
|
||||||
|
@ -294,12 +293,10 @@ NTSTATUS TdiConnect(
|
||||||
|
|
||||||
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
|
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
|
||||||
|
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
||||||
|
|
||||||
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
|
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
|
||||||
DeviceObject, /* Device object */
|
DeviceObject, /* Device object */
|
||||||
ConnectionObject, /* File object */
|
ConnectionObject, /* File object */
|
||||||
&Event, /* Event */
|
NULL, /* Event */
|
||||||
&Iosb); /* Status */
|
&Iosb); /* Status */
|
||||||
if (!*Irp) {
|
if (!*Irp) {
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -314,7 +311,7 @@ NTSTATUS TdiConnect(
|
||||||
RemoteAddress, /* Request connection information */
|
RemoteAddress, /* Request connection information */
|
||||||
RemoteAddress); /* Return connection information */
|
RemoteAddress); /* Return connection information */
|
||||||
|
|
||||||
Status = TdiCall(*Irp, DeviceObject, &Event, &Iosb);
|
Status = TdiCall(*Irp, DeviceObject, NULL, &Iosb);
|
||||||
|
|
||||||
return Status;
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/net/afd/afd/write.c
|
* FILE: drivers/net/afd/afd/write.c
|
||||||
|
@ -30,6 +30,8 @@ NTSTATUS DDKAPI SendComplete
|
||||||
Irp->IoStatus.Status,
|
Irp->IoStatus.Status,
|
||||||
Irp->IoStatus.Information));
|
Irp->IoStatus.Information));
|
||||||
|
|
||||||
|
ASSERT_IRQL(APC_LEVEL);
|
||||||
|
|
||||||
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
if( !SocketAcquireStateLock( FCB ) ) return Status;
|
||||||
|
|
||||||
FCB->SendIrp.InFlightRequest = NULL;
|
FCB->SendIrp.InFlightRequest = NULL;
|
||||||
|
|
Loading…
Reference in a new issue