From 67fd906054d592ed4a8d54deb80348224b121aeb Mon Sep 17 00:00:00 2001 From: Alin Serdean Date: Thu, 26 Jan 2017 19:12:20 +0000 Subject: [PATCH] windows: Allow clients to read from server before disconnect Wait for clients to read from the pipe before disconnecting the server. Found while testing. Signed-off-by: Alin Gabriel Serdean Acked-by: Sairam Venugopal Signed-off-by: Gurucharan Shetty --- lib/stream-windows.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/stream-windows.c b/lib/stream-windows.c index 637920b10..195001441 100644 --- a/lib/stream-windows.c +++ b/lib/stream-windows.c @@ -183,6 +183,9 @@ windows_close(struct stream *stream) /* Disconnect the named pipe in case it was created from a passive stream. */ if (s->server) { + /* Flush the pipe to allow the client to read the pipe's contents + * before disconnecting. */ + FlushFileBuffers(s->fd); DisconnectNamedPipe(s->fd); } CloseHandle(s->fd); -- 2.39.5