CC: Russell Bryant <russ...@ovn.org>; Lance Richardson <lrich...@redhat.com>

Can you please take a look?

Tested-by: Alin Gabriel Serdean <aserd...@ovn.org>

> -----Original Message-----
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Balutoiu
> Sent: Friday, August 25, 2017 6:03 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean <aserd...@ovn.org>
> Subject: [ovs-dev] [PATCH 1/2] windows, python: create a different event
> for sockets
> 
> At the moment the sockets on Windows use the same events that are being
> created for the pipes.
> 
> This is not correct because they should be different events.
> 
> This patch introduces a new event which should be used for sockets.
> The new event needs to be set on automatic reset with its initial state
not
> signaled.
> 
> Signed-off-by: Alin Balutoiu <abalut...@cloudbasesolutions.com>
> Co-authored-by: Alin Gabriel Serdean <aserd...@ovn.org>
> Signed-off-by: Alin Gabriel Serdean <aserd...@ovn.org>
> ---
>  python/ovs/stream.py | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/python/ovs/stream.py b/python/ovs/stream.py index
> 717ea18..9d0536d 100644
> --- a/python/ovs/stream.py
> +++ b/python/ovs/stream.py
> @@ -102,10 +102,6 @@ class Stream(object):
>          self.socket = socket
>          self.pipe = pipe
>          if sys.platform == 'win32':
> -            self._read = pywintypes.OVERLAPPED()
> -            self._read.hEvent = winutils.get_new_event()
> -            self._write = pywintypes.OVERLAPPED()
> -            self._write.hEvent = winutils.get_new_event()
>              if pipe is not None:
>                  # Flag to check if fd is a server HANDLE.  In the case of
a
>                  # server handle we have to issue a disconnect before
closing @@ -
> 114,6 +110,13 @@ class Stream(object):
>                  suffix = name.split(":", 1)[1]
>                  suffix = ovs.util.abs_file_name(ovs.dirs.RUNDIR, suffix)
>                  self._pipename = winutils.get_pipe_name(suffix)
> +                self._read = pywintypes.OVERLAPPED()
> +                self._read.hEvent = winutils.get_new_event()
> +                self._write = pywintypes.OVERLAPPED()
> +                self._write.hEvent = winutils.get_new_event()
> +            else:
> +                self._wevent = winutils.get_new_event(bManualReset=False,
> +
> + bInitialState=False)
> 
>          self.name = name
>          if status == errno.EAGAIN:
> @@ -459,24 +462,24 @@ class Stream(object):
>                                win32file.FD_CLOSE)
>                  try:
>                      win32file.WSAEventSelect(self.socket,
> -                                             self._read.hEvent,
> +                                             self._wevent,
>                                               read_flags)
>                  except pywintypes.error as e:
>                      vlog.err("failed to associate events with socket: %s"
>                               % e.strerror)
> -                poller.fd_wait(self._read.hEvent, ovs.poller.POLLIN)
> +                poller.fd_wait(self._wevent, ovs.poller.POLLIN)
>              else:
>                  write_flags = (win32file.FD_WRITE |
>                                 win32file.FD_CONNECT |
>                                 win32file.FD_CLOSE)
>                  try:
>                      win32file.WSAEventSelect(self.socket,
> -                                             self._write.hEvent,
> +                                             self._wevent,
>                                               write_flags)
>                  except pywintypes.error as e:
>                      vlog.err("failed to associate events with socket: %s"
>                               % e.strerror)
> -                poller.fd_wait(self._write.hEvent, ovs.poller.POLLOUT)
> +                poller.fd_wait(self._wevent, ovs.poller.POLLOUT)
>          else:
>              if wait == Stream.W_RECV:
>                  if self._read:
> --
> 2.10.0.windows.1
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to