{"id":805943,"url":"http://patchwork.ozlabs.org/api/patches/805943/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/1503673364-3166-1-git-send-email-abalutoiu@cloudbasesolutions.com/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1503673364-3166-1-git-send-email-abalutoiu@cloudbasesolutions.com>","list_archive_url":null,"date":"2017-08-25T15:02:48","name":"[ovs-dev,1/2] windows, python: create a different event for sockets","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"564ecaf15f38b3292424f9b3bc2e2631822fe26a","submitter":{"id":70688,"url":"http://patchwork.ozlabs.org/api/people/70688/?format=json","name":"Alin Balutoiu","email":"abalutoiu@cloudbasesolutions.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/1503673364-3166-1-git-send-email-abalutoiu@cloudbasesolutions.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/805943/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/805943/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xf4DN47Clz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 26 Aug 2017 01:03:32 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 86FD5ACB;\n\tFri, 25 Aug 2017 15:03:30 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 9DF4BA86\n\tfor <dev@openvswitch.org>; Fri, 25 Aug 2017 15:03:28 +0000 (UTC)","from mail.cloudbasesolutions.com (mail.cloudbasesolutions.com\n\t[91.232.152.5])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTP id E1EDA113\n\tfor <dev@openvswitch.org>; Fri, 25 Aug 2017 15:02:51 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n\tby mail.cloudbasesolutions.com (Postfix) with ESMTP id 0F8A941A03;\n\tFri, 25 Aug 2017 18:02:51 +0300 (EEST)","from mail.cloudbasesolutions.com ([127.0.0.1])\n\tby localhost (mail.cloudbasesolutions.com [127.0.0.1]) (amavisd-new, \n\tport 10024)\n\twith ESMTP id gr5feNwZN8Ae; Fri, 25 Aug 2017 18:02:50 +0300 (EEST)","from mail.cloudbasesolutions.com (unknown [10.77.78.3])\n\tby mail.cloudbasesolutions.com (Postfix) with ESMTP id 9741B4164E;\n\tFri, 25 Aug 2017 18:02:50 +0300 (EEST)","from CBSEX1.cloudbase.local ([10.77.78.3]) by\n\tCBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0361.001;\n\tFri, 25 Aug 2017 17:02:50 +0200"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","X-Virus-Scanned":"amavisd-new at cloudbasesolutions.com","From":"Alin Balutoiu <abalutoiu@cloudbasesolutions.com>","To":"\"dev@openvswitch.org\" <dev@openvswitch.org>","Thread-Topic":"[PATCH 1/2] windows,\n\tpython: create a different event for sockets","Thread-Index":"AQHTHbM3Rs65ZbbilkOp4BQyaHiVVg==","Date":"Fri, 25 Aug 2017 15:02:48 +0000","Message-ID":"<1503673364-3166-1-git-send-email-abalutoiu@cloudbasesolutions.com>","Accept-Language":"en-US, it-IT","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","x-originating-ip":"[10.77.78.1]","MIME-Version":"1.0","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD\n\tautolearn=unavailable version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Cc":"Alin Gabriel Serdean <aserdean@ovn.org>","Subject":"[ovs-dev] [PATCH 1/2] windows,\n\tpython: create a different event for sockets","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"At the moment the sockets on Windows use the same events\nthat are being created for the pipes.\n\nThis is not correct because they should be different events.\n\nThis patch introduces a new event which should be used for sockets.\nThe new event needs to be set on automatic reset with its initial\nstate not signaled.\n\nSigned-off-by: Alin Balutoiu <abalutoiu@cloudbasesolutions.com>\nCo-authored-by: Alin Gabriel Serdean <aserdean@ovn.org>\nSigned-off-by: Alin Gabriel Serdean <aserdean@ovn.org>\n---\n python/ovs/stream.py | 19 +++++++++++--------\n 1 file changed, 11 insertions(+), 8 deletions(-)","diff":"diff --git a/python/ovs/stream.py b/python/ovs/stream.py\nindex 717ea18..9d0536d 100644\n--- a/python/ovs/stream.py\n+++ b/python/ovs/stream.py\n@@ -102,10 +102,6 @@ class Stream(object):\n         self.socket = socket\n         self.pipe = pipe\n         if sys.platform == 'win32':\n-            self._read = pywintypes.OVERLAPPED()\n-            self._read.hEvent = winutils.get_new_event()\n-            self._write = pywintypes.OVERLAPPED()\n-            self._write.hEvent = winutils.get_new_event()\n             if pipe is not None:\n                 # Flag to check if fd is a server HANDLE.  In the case of a\n                 # server handle we have to issue a disconnect before closing\n@@ -114,6 +110,13 @@ class Stream(object):\n                 suffix = name.split(\":\", 1)[1]\n                 suffix = ovs.util.abs_file_name(ovs.dirs.RUNDIR, suffix)\n                 self._pipename = winutils.get_pipe_name(suffix)\n+                self._read = pywintypes.OVERLAPPED()\n+                self._read.hEvent = winutils.get_new_event()\n+                self._write = pywintypes.OVERLAPPED()\n+                self._write.hEvent = winutils.get_new_event()\n+            else:\n+                self._wevent = winutils.get_new_event(bManualReset=False,\n+                                                      bInitialState=False)\n \n         self.name = name\n         if status == errno.EAGAIN:\n@@ -459,24 +462,24 @@ class Stream(object):\n                               win32file.FD_CLOSE)\n                 try:\n                     win32file.WSAEventSelect(self.socket,\n-                                             self._read.hEvent,\n+                                             self._wevent,\n                                              read_flags)\n                 except pywintypes.error as e:\n                     vlog.err(\"failed to associate events with socket: %s\"\n                              % e.strerror)\n-                poller.fd_wait(self._read.hEvent, ovs.poller.POLLIN)\n+                poller.fd_wait(self._wevent, ovs.poller.POLLIN)\n             else:\n                 write_flags = (win32file.FD_WRITE |\n                                win32file.FD_CONNECT |\n                                win32file.FD_CLOSE)\n                 try:\n                     win32file.WSAEventSelect(self.socket,\n-                                             self._write.hEvent,\n+                                             self._wevent,\n                                              write_flags)\n                 except pywintypes.error as e:\n                     vlog.err(\"failed to associate events with socket: %s\"\n                              % e.strerror)\n-                poller.fd_wait(self._write.hEvent, ovs.poller.POLLOUT)\n+                poller.fd_wait(self._wevent, ovs.poller.POLLOUT)\n         else:\n             if wait == Stream.W_RECV:\n                 if self._read:\n","prefixes":["ovs-dev","1/2"]}