QWindowsPipeWriter: suppress a warning on unexpected peer disconnection

The other side can close the pipe at any time independently of us, so
ignore the ERROR_PIPE_NOT_CONNECTED error code if the write operation
failed.

Change-Id: I4f7ccd73c19ca2dd24fa1c9f33b5f60541a7521d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Alex Trotsenko 2021-08-31 19:44:53 +03:00
parent 5c779f207f
commit 340131b4be

View File

@ -262,9 +262,15 @@ bool QWindowsPipeWriter::writeCompleted(DWORD errorCode, DWORD numberOfBytesWrit
lastError = errorCode;
writeBuffer.clear();
// The other end has closed the pipe. This can happen in QLocalSocket. Do not warn.
if (errorCode != ERROR_OPERATION_ABORTED && errorCode != ERROR_NO_DATA)
switch (errorCode) {
case ERROR_PIPE_NOT_CONNECTED: // the other end has closed the pipe
case ERROR_OPERATION_ABORTED: // the operation was canceled
case ERROR_NO_DATA: // the pipe is being closed
break;
default:
qErrnoWarning(errorCode, "QWindowsPipeWriter: write failed.");
break;
}
return false;
}