From nobody Sun Feb 8 14:52:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150522987227020.122563551780786; Tue, 12 Sep 2017 08:24:32 -0700 (PDT) Received: from localhost ([::1]:36501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drn37-00068u-8x for importer@patchew.org; Tue, 12 Sep 2017 11:24:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drn12-0004jY-J9 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drn10-0006zk-23 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:20 -0400 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]:35018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1drn0z-0006zA-Rg for qemu-devel@nongnu.org; Tue, 12 Sep 2017 11:22:17 -0400 Received: by mail-pf0-x230.google.com with SMTP id q76so5570352pfq.2 for ; Tue, 12 Sep 2017 08:22:17 -0700 (PDT) Received: from servo.cypherpath.com (68-113-0-218.static.knwc.wa.charter.com. [68.113.0.218]) by smtp.gmail.com with ESMTPSA id d18sm12753054pfk.11.2017.09.12.08.22.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 08:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypherpath.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=; b=Ej4eRkvHg8mEXWtimMiEKeoZDvM1G0rkejGo171zIBYhk14tA+J+tav9Jqo2rD3z5O 3NihWpaTkcqiBfhPF2g56cZr/UENJt/19z9vB3sOjf1CbLFJEGM9H9ZOhX7HwxMYBF6Y wgTNQFm0eEbr1sdhkLbhO37NHKN8fnqH73p3g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7v8W86ncP3U13C6xTc1W8Y2BQWzG/+kj5N+vW6FffrM=; b=octTNLDrMf7YhP7Zesb8Tena2MALsM/iCyQdkaGU/C4MKlswqjob53oOesUW8c9tmz D6juLEXR6pJfGEB3BwW6Xk+Q8YOZgnI364ChmpesbXuEYta5X17K+goqB8j8VrLtJBo7 vV0OYFdO5j2Qu4on9Z38l2AeYTDtgUFC5i2RpJ/g0/mvcvRzTCnWJDcSSY8qGAH3E5zu 6ktq0l+ED/wxzNxKyvehk7Yi084oLVwRHulmVIvL7/8xTDlKAz/JtpmfpOSKzrSIbNTB 7KlGB+X5GP6oKL+I/byIkLlLpbvEIoQbvBi6maXabz7QdWHG3ugGWj2ErSXieW45Ihpd uBNg== X-Gm-Message-State: AHPjjUi9z5hoekeicsSEFe+U+nCyzxq4bfcKLlgiYBZEqp9jfiUOefu4 fH2WIz2OvX+qwhWKhpfmnnKXMLsEZz4MChcCaDoaMDwDvQ15noQ6M+uHNnFvJHl6mXfPp3i3rFw hrts1 MIME-Version: 1.0 X-Google-Smtp-Source: ADKCNb6OgaoU+P3BPlAlOX/a5SSaqWRPLgd4PnbwKWNlyT9Xt3HSFDvkfholleluWI9aaY62cslJEA== X-Received: by 10.98.206.15 with SMTP id y15mr10239857pfg.25.1505229736709; Tue, 12 Sep 2017 08:22:16 -0700 (PDT) From: Brandon Carpenter 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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::230 Subject: [Qemu-devel] [PATCH v3 1/7] io: Always remove an old channel watch before adding a new one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: brandon.carpenter@cypherpath.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Also set saved handle to zero when removing without adding a new watch. Signed-off-by: Brandon Carpenter Reviewed-by: Paolo Bonzini Reviewed-by: Daniel P. Berrange --- ui/vnc-auth-vencrypt.c | 3 +++ ui/vnc-ws.c | 6 ++++++ ui/vnc.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index ffaab57550..c3eece4fa7 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -77,6 +77,9 @@ static void vnc_tls_handshake_done(QIOTask *task, vnc_client_error(vs); error_free(err); } else { + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } vs->ioc_tag =3D qio_channel_add_watch( vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); start_auth_vencrypt_subauth(vs); diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index f530cd5474..eaf309553c 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -36,6 +36,9 @@ static void vncws_tls_handshake_done(QIOTask *task, error_free(err); } else { VNC_DEBUG("TLS handshake complete, starting websocket handshake\n"= ); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } vs->ioc_tag =3D qio_channel_add_watch( QIO_CHANNEL(vs->ioc), G_IO_IN, vncws_handshake_io, vs, NULL); } @@ -97,6 +100,9 @@ static void vncws_handshake_done(QIOTask *task, } else { VNC_DEBUG("Websock handshake complete, starting VNC protocol\n"); vnc_start_protocol(vs); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } vs->ioc_tag =3D qio_channel_add_watch( vs->ioc, G_IO_IN, vnc_client_io, vs, NULL); } diff --git a/ui/vnc.c b/ui/vnc.c index 0b5dbc62e4..62f7a3f30a 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1121,6 +1121,7 @@ static void vnc_disconnect_start(VncState *vs) vnc_set_share_mode(vs, VNC_SHARE_MODE_DISCONNECTED); if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); + vs->ioc_tag =3D 0; } qio_channel_close(vs->ioc, NULL); vs->disconnecting =3D TRUE; @@ -2931,6 +2932,9 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSoc= ket *sioc, VNC_DEBUG("New client on socket %p\n", vs->sioc); update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE); qio_channel_set_blocking(vs->ioc, false, NULL); + if (vs->ioc_tag) { + g_source_remove(vs->ioc_tag); + } if (websocket) { vs->websocket =3D 1; if (vd->tlscreds) { --=20 2.14.1 --=20 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is=20 for the sole use of the intended recipient(s) and may contain proprietary,=20 confidential or privileged information or otherwise be protected by law.=20 Any unauthorized review, use, disclosure or distribution is prohibited. If=20 you are not the intended recipient, please notify the sender and destroy=20 all copies and the original message.