mirror of
https://github.com/reactos/reactos.git
synced 2025-06-22 22:40:19 +00:00
[NPFS]
- Partially revert r47370 and apply a better patch - Change ReadEvent and WriteEvent to notification events because we reset those events manually when we run out of buffer space svn path=/trunk/; revision=47375
This commit is contained in:
parent
b85a7deb22
commit
f73d8199f7
2 changed files with 10 additions and 20 deletions
|
@ -205,8 +205,8 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
|||
ClientCcb->MaxDataLength = Fcb->OutboundQuota;
|
||||
ExInitializeFastMutex(&ClientCcb->DataListLock);
|
||||
KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientCcb->ReadEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientCcb->WriteEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientCcb->ReadEvent, NotificationEvent, FALSE);
|
||||
KeInitializeEvent(&ClientCcb->WriteEvent, NotificationEvent, FALSE);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -540,8 +540,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
|||
DPRINT("CCB: %p\n", Ccb);
|
||||
|
||||
KeInitializeEvent(&Ccb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&Ccb->ReadEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&Ccb->WriteEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeEvent(&Ccb->ReadEvent, NotificationEvent, FALSE);
|
||||
KeInitializeEvent(&Ccb->WriteEvent, NotificationEvent, FALSE);
|
||||
|
||||
KeLockMutex(&Fcb->CcbListLock);
|
||||
InsertTailList(&Fcb->ServerCcbListHead, &Ccb->CcbListEntry);
|
||||
|
@ -619,7 +619,6 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject,
|
|||
ExAcquireFastMutex(&OtherSide->DataListLock);
|
||||
ExAcquireFastMutex(&Ccb->DataListLock);
|
||||
}
|
||||
OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
OtherSide->OtherSide = NULL;
|
||||
/*
|
||||
* Signaling the write event. If is possible that an other
|
||||
|
@ -745,7 +744,6 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
/* Disconnect the pipes */
|
||||
if (Ccb->OtherSide)
|
||||
{
|
||||
Ccb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
||||
Ccb->OtherSide->OtherSide = NULL;
|
||||
Ccb->OtherSide = NULL;
|
||||
}
|
||||
|
|
|
@ -331,11 +331,8 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0))
|
||||
{
|
||||
if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
DPRINT("File pipe broken\n");
|
||||
if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
}
|
||||
else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||
Status = STATUS_PIPE_LISTENING;
|
||||
else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||
|
@ -443,7 +440,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
break;
|
||||
}
|
||||
if ((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) && (Ccb->ReadDataAvailable == 0))
|
||||
if (((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide)) && (Ccb->ReadDataAvailable == 0))
|
||||
{
|
||||
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
|
@ -800,13 +797,13 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
if ((ReaderCcb->WriteQuotaAvailable == 0))
|
||||
{
|
||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide)
|
||||
{
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
||||
goto done;
|
||||
}
|
||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
||||
|
||||
DPRINT("Write Waiting for buffer space (%S)\n", Fcb->PipeName.Buffer);
|
||||
|
@ -830,20 +827,15 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
* It's possible that the event was signaled because the
|
||||
* other side of pipe was closed.
|
||||
*/
|
||||
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide)
|
||||
{
|
||||
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
goto done;
|
||||
}
|
||||
/* Check that the pipe has not been closed */
|
||||
if (ReaderCcb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
if (ReaderCcb->PipeState != FILE_PIPE_CONNECTED_STATE || !ReaderCcb->OtherSide)
|
||||
{
|
||||
/* If the other side is valid, fire event */
|
||||
if (Ccb)
|
||||
{
|
||||
KeResetEvent(&Ccb->WriteEvent);
|
||||
}
|
||||
Status = STATUS_PIPE_BROKEN;
|
||||
goto done;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue