mirror of
https://github.com/reactos/reactos.git
synced 2025-06-23 09:30:17 +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;
|
ClientCcb->MaxDataLength = Fcb->OutboundQuota;
|
||||||
ExInitializeFastMutex(&ClientCcb->DataListLock);
|
ExInitializeFastMutex(&ClientCcb->DataListLock);
|
||||||
KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||||
KeInitializeEvent(&ClientCcb->ReadEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&ClientCcb->ReadEvent, NotificationEvent, FALSE);
|
||||||
KeInitializeEvent(&ClientCcb->WriteEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&ClientCcb->WriteEvent, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -540,8 +540,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
|
||||||
DPRINT("CCB: %p\n", Ccb);
|
DPRINT("CCB: %p\n", Ccb);
|
||||||
|
|
||||||
KeInitializeEvent(&Ccb->ConnectEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Ccb->ConnectEvent, SynchronizationEvent, FALSE);
|
||||||
KeInitializeEvent(&Ccb->ReadEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Ccb->ReadEvent, NotificationEvent, FALSE);
|
||||||
KeInitializeEvent(&Ccb->WriteEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Ccb->WriteEvent, NotificationEvent, FALSE);
|
||||||
|
|
||||||
KeLockMutex(&Fcb->CcbListLock);
|
KeLockMutex(&Fcb->CcbListLock);
|
||||||
InsertTailList(&Fcb->ServerCcbListHead, &Ccb->CcbListEntry);
|
InsertTailList(&Fcb->ServerCcbListHead, &Ccb->CcbListEntry);
|
||||||
|
@ -619,7 +619,6 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject,
|
||||||
ExAcquireFastMutex(&OtherSide->DataListLock);
|
ExAcquireFastMutex(&OtherSide->DataListLock);
|
||||||
ExAcquireFastMutex(&Ccb->DataListLock);
|
ExAcquireFastMutex(&Ccb->DataListLock);
|
||||||
}
|
}
|
||||||
OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
|
||||||
OtherSide->OtherSide = NULL;
|
OtherSide->OtherSide = NULL;
|
||||||
/*
|
/*
|
||||||
* Signaling the write event. If is possible that an other
|
* Signaling the write event. If is possible that an other
|
||||||
|
@ -745,7 +744,6 @@ NpfsClose(PDEVICE_OBJECT DeviceObject,
|
||||||
/* Disconnect the pipes */
|
/* Disconnect the pipes */
|
||||||
if (Ccb->OtherSide)
|
if (Ccb->OtherSide)
|
||||||
{
|
{
|
||||||
Ccb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
|
|
||||||
Ccb->OtherSide->OtherSide = NULL;
|
Ccb->OtherSide->OtherSide = NULL;
|
||||||
Ccb->OtherSide = NULL;
|
Ccb->OtherSide = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,11 +331,8 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0))
|
if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0))
|
||||||
{
|
{
|
||||||
if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE)
|
if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
|
||||||
{
|
|
||||||
DPRINT("File pipe broken\n");
|
|
||||||
Status = STATUS_PIPE_BROKEN;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
}
|
|
||||||
else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
|
else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
|
||||||
Status = STATUS_PIPE_LISTENING;
|
Status = STATUS_PIPE_LISTENING;
|
||||||
else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
|
else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||||
|
@ -443,7 +440,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
break;
|
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);
|
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
||||||
Status = STATUS_PIPE_BROKEN;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
|
@ -800,13 +797,13 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
if ((ReaderCcb->WriteQuotaAvailable == 0))
|
if ((ReaderCcb->WriteQuotaAvailable == 0))
|
||||||
{
|
{
|
||||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide)
|
||||||
if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
|
|
||||||
{
|
{
|
||||||
Status = STATUS_PIPE_BROKEN;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||||
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
||||||
|
|
||||||
DPRINT("Write Waiting for buffer space (%S)\n", Fcb->PipeName.Buffer);
|
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
|
* It's possible that the event was signaled because the
|
||||||
* other side of pipe was closed.
|
* 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);
|
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
||||||
Status = STATUS_PIPE_BROKEN;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Check that the pipe has not been closed */
|
/* 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;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue