diff mbox

[ovs-dev] windows: Allow clients to read from server before disconnect

Message ID 20170126191214.11428-1-aserdean@cloudbasesolutions.com
State Accepted
Delegated to: Guru Shetty
Headers show

Commit Message

Alin Serdean Jan. 26, 2017, 7:12 p.m. UTC
Wait for clients to read from the pipe before disconnecting the server.

Found while testing.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
Intended for master and branch-2.7
---
 lib/stream-windows.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Gurucharan Shetty Jan. 27, 2017, 10:26 p.m. UTC | #1
On 26 January 2017 at 11:12, Alin Serdean <aserdean@cloudbasesolutions.com>
wrote:

> Wait for clients to read from the pipe before disconnecting the server.
>
> Found while testing.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
> ---
> Intended for master and branch-2.7
>
Applied.


> ---
>  lib/stream-windows.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/stream-windows.c b/lib/stream-windows.c
> index 637920b..1950014 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.10.2.windows.1
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox

Patch

diff --git a/lib/stream-windows.c b/lib/stream-windows.c
index 637920b..1950014 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);