{"id":811733,"url":"http://patchwork.ozlabs.org/api/patches/811733/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170908173801.15205-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":"<20170908173801.15205-2-brandon.carpenter@cypherpath.com>","list_archive_url":null,"date":"2017-09-08T17:37:56","name":"[v2,1/6] 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/20170908173801.15205-2-brandon.carpenter@cypherpath.com/mbox/","series":[{"id":2262,"url":"http://patchwork.ozlabs.org/api/series/2262/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2262","date":"2017-09-08T17:37:56","name":"Update websocket code to more fully support the RFC","version":2,"mbox":"http://patchwork.ozlabs.org/series/2262/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811733/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811733/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=\"jn410Qwz\"; 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 3xpl9j582bz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Sep 2017 03:46:17 +1000 (AEST)","from localhost ([::1]:46710 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 1dqNM7-0006W9-Op\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 13:46:15 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:40096)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1dqNFQ-0000KJ-6R\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 13:39:21 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <brandon.carpenter@cypherpath.com>)\n\tid 1dqNFM-0008Hn-4g\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 13:39:20 -0400","from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]:35051)\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 1dqNFL-0008Gr-UQ\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 13:39:16 -0400","by mail-pg0-x235.google.com with SMTP id 188so5918520pgb.2\n\tfor <qemu-devel@nongnu.org>; Fri, 08 Sep 2017 10:39:15 -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\tc30sm4556833pgn.33.2017.09.08.10.39.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 10:39:14 -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:in-reply-to:references;\n\tbh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=;\n\tb=jn410Qwzvh1lvaZZr4FZgpjMjoLXG9P+1CVF3Ex/0zTjGu5A0HZonVwe9tc20D4Qrm\n\tC8t+v7YOfOiL7pkMWi4p4ueJqYAA/usX4bePChCkuCmnhGPYviiqvD9jPPcs57H9eTwO\n\tI00HoEPjk6U8zZb4bpNgJj3Tq1s01rHmHBJkY=","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:in-reply-to:references;\n\tbh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=;\n\tb=uj0p5rApQC7ELNhkRjF2MbpQp6QcE9tPIcWwk3rapoIy852XEe4OJVcjw9YYSV/y4L\n\tuNOJGMrhdGPyvlGX0OHzkpEb2JMLWXR6/UvXtCLdcT4iGE6FtghE9GlmAi4SXLqnzmfN\n\tN8jHtUw6x3dBPar/jF6xJJRVLUKe75BakZB4QlsmskfhcUxw1ofFkI0QmDhqL0RP1MEa\n\trBo5gd552F3txZDGvYL/wXwbtVE5u2PcwD0DzfDBX8nT/llC38iO3J6SUT9PyuFg+hUC\n\tlxpbMtexbBZPUmZ/sL+UhabW/vnvwXu2dtP09tKfvW8aNfln2RPL0GYGozkdUOGHddmd\n\t1UeQ==","X-Gm-Message-State":"AHPjjUg7OqWhNH/ueL/9pqLUpEprv6eTbQicyoQ7NqbIw7jeOlRKyBWB\n\tvNjlT02vO3ha33gcjEAxnaMSGbBniJmE1PHVI3ITtntsHXAkRxMdMwL962U2nAKVxj+dRFC/CKw\n\tDqMTU","MIME-Version":"1.0","X-Google-Smtp-Source":"ADKCNb4JL0M+ncvGdZfNNc8hvZGn4Z/nnSXkHyx9C2O2OVsQJ1Sj3I4t51w179Wlrv79Ite7q/t/CA==","X-Received":"by 10.84.217.91 with SMTP id e27mr4091568plj.99.1504892354820;\n\tFri, 08 Sep 2017 10:39:14 -0700 (PDT)","From":"Brandon Carpenter <brandon.carpenter@cypherpath.com>","To":"qemu-devel@nongnu.org","Date":"Fri,  8 Sep 2017 10:37:56 -0700","Message-Id":"<20170908173801.15205-2-brandon.carpenter@cypherpath.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":["<20170908173801.15205-1-brandon.carpenter@cypherpath.com>","<20170724184217.21381-1-brandon.carpenter@cypherpath.com>"],"References":["<20170908173801.15205-1-brandon.carpenter@cypherpath.com>","<20170724184217.21381-1-brandon.carpenter@cypherpath.com>\n\t<20170724181544.20292-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:c05::235","Subject":"[Qemu-devel] [PATCH v2 1/6] 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":["v2","1/6"]}