[ovs-dev] [PATCH] windows, python: Fix event type returned from poller
Russell Bryant
russell at ovn.org
Tue Aug 22 12:22:15 UTC 2017
On Tue, Aug 22, 2017 at 6:47 AM, Alin Balutoiu
<abalutoiu at cloudbasesolutions.com> wrote:
> The function poll from poller should return a list of tuples
> containing the events and their types.
>
> On Windows the event type is not returned at the moment.
> Instead of returning zero all the time, we check to see
> the type of event and we set it accordingly before returning
> the list.
>
> This is used only for debugging purposes inside the function
> "__log_wakeup" later on.
>
> Signed-off-by: Alin Balutoiu <abalutoiu at cloudbasesolutions.com>
> ---
> python/ovs/poller.py | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/python/ovs/poller.py b/python/ovs/poller.py
> index 809e512..2f3fcf9 100644
> --- a/python/ovs/poller.py
> +++ b/python/ovs/poller.py
> @@ -112,7 +112,14 @@ class _SelectSelect(object):
> if retval == winutils.winerror.WAIT_TIMEOUT:
> return []
>
> - return [(events[retval], 0)]
> + if events[retval] in self.rlist:
> + revent = POLLIN
> + elif events[retval] in self.wlist:
> + revent = POLLOUT
> + else:
> + revent = POLLERR
> +
> + return [(events[retval], revent)]
> else:
> if timeout == -1:
> # epoll uses -1 for infinite timeout, select uses None.
Acked-by: Russell Bryant <russell at ovn.org>
I tried looking up docs of WaitForMultipleObjects to look at possible
return values. It looks like WAIT_FAILED could be returned and it
would cause an exception when used as the index to events. If that's
right, it was true before the patch as well, though.
--
Russell Bryant
More information about the dev
mailing list