{"id":812904,"url":"http://patchwork.ozlabs.org/api/patches/812904/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912152153.7729-2-brandon.carpenter@cypherpath.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170912152153.7729-2-brandon.carpenter@cypherpath.com>","list_archive_url":null,"date":"2017-09-12T15:21:47","name":"[v3,1/7] io: Always remove an old channel watch before adding a new one","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bc6d17c8a7f33299d8e569793ae661916afa1ca1","submitter":{"id":72031,"url":"http://patchwork.ozlabs.org/api/people/72031/?format=json","name":"Brandon Carpenter","email":"brandon.carpenter@cypherpath.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912152153.7729-2-brandon.carpenter@cypherpath.com/mbox/","series":[{"id":2725,"url":"http://patchwork.ozlabs.org/api/series/2725/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2725","date":"2017-09-12T15:21:48","name":"Update websocket code to more fully support the RFC","version":3,"mbox":"http://patchwork.ozlabs.org/series/2725/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812904/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812904/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=cypherpath.com header.i=@cypherpath.com\n\theader.b=\"Ej4eRkvH\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs7ps0fSvz9s7f\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 01:23:17 +1000 (AEST)","from localhost ([::1]:36494 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drn1v-0004ns-4R\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 11:23:15 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:40476)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn12-0004jY-J9\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:24 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn10-0006zk-23\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:20 -0400","from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]:35018)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1drn0z-0006zA-Rg\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:17 -0400","by mail-pf0-x230.google.com with SMTP id q76so5570352pfq.2\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 08:22:17 -0700 (PDT)","from servo.cypherpath.com (68-113-0-218.static.knwc.wa.charter.com.\n\t[68.113.0.218]) by smtp.gmail.com with ESMTPSA id\n\td18sm12753054pfk.11.2017.09.12.08.22.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 08:22:15 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=cypherpath.com; s=google;\n\th=mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references; bh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=;\n\tb=Ej4eRkvHg8mEXWtimMiEKeoZDvM1G0rkejGo171zIBYhk14tA+J+tav9Jqo2rD3z5O\n\t3NihWpaTkcqiBfhPF2g56cZr/UENJt/19z9vB3sOjf1CbLFJEGM9H9ZOhX7HwxMYBF6Y\n\twgTNQFm0eEbr1sdhkLbhO37NHKN8fnqH73p3g=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=;\n\tb=octTNLDrMf7YhP7Zesb8Tena2MALsM/iCyQdkaGU/C4MKlswqjob53oOesUW8c9tmz\n\tD6juLEXR6pJfGEB3BwW6Xk+Q8YOZgnI364ChmpesbXuEYta5X17K+goqB8j8VrLtJBo7\n\tvV0OYFdO5j2Qu4on9Z38l2AeYTDtgUFC5i2RpJ/g0/mvcvRzTCnWJDcSSY8qGAH3E5zu\n\t6ktq0l+ED/wxzNxKyvehk7Yi084oLVwRHulmVIvL7/8xTDlKAz/JtpmfpOSKzrSIbNTB\n\t7KlGB+X5GP6oKL+I/byIkLlLpbvEIoQbvBi6maXabz7QdWHG3ugGWj2ErSXieW45Ihpd\n\tuBNg==","X-Gm-Message-State":"AHPjjUi9z5hoekeicsSEFe+U+nCyzxq4bfcKLlgiYBZEqp9jfiUOefu4\n\tfH2WIz2OvX+qwhWKhpfmnnKXMLsEZz4MChcCaDoaMDwDvQ15noQ6M+uHNnFvJHl6mXfPp3i3rFw\n\thrts1","MIME-Version":"1.0","X-Google-Smtp-Source":"ADKCNb6OgaoU+P3BPlAlOX/a5SSaqWRPLgd4PnbwKWNlyT9Xt3HSFDvkfholleluWI9aaY62cslJEA==","X-Received":"by 10.98.206.15 with SMTP id y15mr10239857pfg.25.1505229736709; \n\tTue, 12 Sep 2017 08:22:16 -0700 (PDT)","From":"Brandon Carpenter <brandon.carpenter@cypherpath.com>","To":"qemu-devel@nongnu.org","Date":"Tue, 12 Sep 2017 08:21:47 -0700","Message-Id":"<20170912152153.7729-2-brandon.carpenter@cypherpath.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170912152153.7729-1-brandon.carpenter@cypherpath.com>","References":"<20170912152153.7729-1-brandon.carpenter@cypherpath.com>","Content-Type":"text/plain; charset=\"US-ASCII\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400e:c00::230","Subject":"[Qemu-devel] [PATCH v3 1/7] io: Always remove an old channel watch\n\tbefore adding a new one","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"brandon.carpenter@cypherpath.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Also set saved handle to zero when removing without adding a new watch.\n\nSigned-off-by: Brandon Carpenter <brandon.carpenter@cypherpath.com>\nReviewed-by: Paolo Bonzini <pbonzini@redhat.com>\nReviewed-by: Daniel P. Berrange <berrange@redhat.com>\n---\n ui/vnc-auth-vencrypt.c | 3 +++\n ui/vnc-ws.c            | 6 ++++++\n ui/vnc.c               | 4 ++++\n 3 files changed, 13 insertions(+)","diff":"diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c\nindex ffaab57550..c3eece4fa7 100644\n--- a/ui/vnc-auth-vencrypt.c\n+++ b/ui/vnc-auth-vencrypt.c\n@@ -77,6 +77,9 @@ static void vnc_tls_handshake_done(QIOTask *task,\n         vnc_client_error(vs);\n         error_free(err);\n     } else {\n+        if (vs->ioc_tag) {\n+            g_source_remove(vs->ioc_tag);\n+        }\n         vs->ioc_tag = qio_channel_add_watch(\n             vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL);\n         start_auth_vencrypt_subauth(vs);\ndiff --git a/ui/vnc-ws.c b/ui/vnc-ws.c\nindex f530cd5474..eaf309553c 100644\n--- a/ui/vnc-ws.c\n+++ b/ui/vnc-ws.c\n@@ -36,6 +36,9 @@ static void vncws_tls_handshake_done(QIOTask *task,\n         error_free(err);\n     } else {\n         VNC_DEBUG(\"TLS handshake complete, starting websocket handshake\\n\");\n+        if (vs->ioc_tag) {\n+            g_source_remove(vs->ioc_tag);\n+        }\n         vs->ioc_tag = qio_channel_add_watch(\n             QIO_CHANNEL(vs->ioc), G_IO_IN, vncws_handshake_io, vs, NULL);\n     }\n@@ -97,6 +100,9 @@ static void vncws_handshake_done(QIOTask *task,\n     } else {\n         VNC_DEBUG(\"Websock handshake complete, starting VNC protocol\\n\");\n         vnc_start_protocol(vs);\n+        if (vs->ioc_tag) {\n+            g_source_remove(vs->ioc_tag);\n+        }\n         vs->ioc_tag = qio_channel_add_watch(\n             vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);\n     }\ndiff --git a/ui/vnc.c b/ui/vnc.c\nindex 0b5dbc62e4..62f7a3f30a 100644\n--- a/ui/vnc.c\n+++ b/ui/vnc.c\n@@ -1121,6 +1121,7 @@ static void vnc_disconnect_start(VncState *vs)\n     vnc_set_share_mode(vs, VNC_SHARE_MODE_DISCONNECTED);\n     if (vs->ioc_tag) {\n         g_source_remove(vs->ioc_tag);\n+        vs->ioc_tag = 0;\n     }\n     qio_channel_close(vs->ioc, NULL);\n     vs->disconnecting = TRUE;\n@@ -2931,6 +2932,9 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,\n     VNC_DEBUG(\"New client on socket %p\\n\", vs->sioc);\n     update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);\n     qio_channel_set_blocking(vs->ioc, false, NULL);\n+    if (vs->ioc_tag) {\n+        g_source_remove(vs->ioc_tag);\n+    }\n     if (websocket) {\n         vs->websocket = 1;\n         if (vd->tlscreds) {\n","prefixes":["v3","1/7"]}