On Windows, we create "unix sockets" by creating TCP sockets and hiding the TCP port number in files. When we close the pstream session, we need to delete the file.
Signed-off-by: Gurucharan Shetty <gshe...@nicira.com> --- lib/stream-fd-windows.c | 4 ++++ lib/stream-tcp.c | 19 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/stream-fd-windows.c b/lib/stream-fd-windows.c index db60810..23fd55c 100644 --- a/lib/stream-fd-windows.c +++ b/lib/stream-fd-windows.c @@ -216,6 +216,10 @@ pfd_close(struct pstream *pstream) WSAEventSelect(ps->fd, NULL, 0); CloseHandle(ps->wevent); closesocket(ps->fd); + if (ps->unlink_path) { + fatal_signal_unlink_file_now(ps->unlink_path); + free(ps->unlink_path); + } free(ps); } diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c index 0d08812..0a1ba6b 100644 --- a/lib/stream-tcp.c +++ b/lib/stream-tcp.c @@ -155,7 +155,7 @@ static int ptcp_accept(int fd, const struct sockaddr_storage *, static int new_pstream(char *suffix, struct pstream **pstreamp, int dscp, - bool kernel_print_port) + char *unlink_path, bool kernel_print_port) { char bound_name[SS_NTOP_BUFSIZE + 16]; char addrbuf[SS_NTOP_BUFSIZE]; @@ -174,7 +174,7 @@ new_pstream(char *suffix, struct pstream **pstreamp, int dscp, snprintf(bound_name, sizeof bound_name, "ptcp:%"PRIu16":%s", port, ss_format_address(&ss, addrbuf, sizeof addrbuf)); - error = new_fd_pstream(bound_name, fd, ptcp_accept, set_dscp, NULL, + error = new_fd_pstream(bound_name, fd, ptcp_accept, set_dscp, unlink_path, pstreamp); if (!error) { pstream_set_bound_port(*pstreamp, htons(port)); @@ -186,7 +186,7 @@ static int ptcp_open(const char *name OVS_UNUSED, char *suffix, struct pstream **pstreamp, uint8_t dscp) { - return new_pstream(suffix, pstreamp, dscp, true); + return new_pstream(suffix, pstreamp, dscp, NULL, true); } static int @@ -224,12 +224,6 @@ pwindows_open(const char *name OVS_UNUSED, char *suffix, suffix_new = xstrdup("0:127.0.0.1"); - error = new_pstream(suffix_new, pstreamp, dscp, false); - if (error) { - goto exit; - } - listener = *pstreamp; - /* If the path does not contain a ':', assume it is relative to * OVS_RUNDIR. */ if (!strchr(suffix, ':')) { @@ -238,6 +232,12 @@ pwindows_open(const char *name OVS_UNUSED, char *suffix, path = strdup(suffix); } + error = new_pstream(suffix_new, pstreamp, dscp, path, false); + if (error) { + goto exit; + } + listener = *pstreamp; + file = fopen(path, "w"); if (!file) { error = errno; @@ -253,7 +253,6 @@ pwindows_open(const char *name OVS_UNUSED, char *suffix, goto exit; } fclose(file); - free(path); exit: free(suffix_new); -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev