From nobody Fri Mar 29 01:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 149381458338086.56796673276858; Wed, 3 May 2017 05:29:43 -0700 (PDT) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 51831820726; Wed, 3 May 2017 12:29:41 +0000 (UTC) Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) by lists.ovirt.org (Postfix) with ESMTPS id 80577820720 for ; Wed, 3 May 2017 12:29:16 +0000 (UTC) Received: by mail-qk0-f182.google.com with SMTP id u75so12807314qka.3 for ; Wed, 03 May 2017 05:29:16 -0700 (PDT) Received: from localhost.localdomain ([177.41.192.154]) by smtp.gmail.com with ESMTPSA id f127sm1288685qkb.33.2017.05.03.05.29.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 05:29:15 -0700 (PDT) X-Original-To: kimchi-devel@ovirt.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Zb0HzstATEFyf7SdpviggYPHpQ0GFYjy1BGtdTobfzo=; b=XbyJI1Y5UCQdDvuJaXDdhYrIQ0V2svmBylX0l57+Bu2YX2O0bnmBPFZ6im3hK0M+8x TY3wFXDsQ0w1L/Y7VM73yjw2lbitSzTFK6lP9SyAsPCFxMZ39asGoky5Ev6hhUEIKf/j 5Xpml5zcXG84tEBWjcNg0qGqBucOEbkg+hgeOFmeHqPKMCCVW1cCKzLULHDcFpunguhW v/mubun5O/XW4WKGVAilYoFJlLUtguK5PQbzhZFnL6tC7cIGxplj+aSmgK5qX4Uo5i77 pCVcE3Ky9sdK8xjReHWolyrz5q1YGqgg3vfZoc7RaWfFdeuOiLJDPy17VUXTAt7/J6mp sVYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Zb0HzstATEFyf7SdpviggYPHpQ0GFYjy1BGtdTobfzo=; b=UG1pkv3VhNZHO5P1i9vLohLXGd9A6aOzkViE5etbMGEHnKrKPlg+z+zg2Gl+PpCMH/ wzryZ5OST+2H6jcc5NEYRIKO0Ee4upzyX98UzjmQyD2n9ZoF5rPPA/fRn/oxLLyPtrgA SvQdWTXUP20m5BD1woVNTY3ca+KHd4aYIFnmjWnvaJz0v3F2kcrXAo5v91qWHvGl8o+K 00TFEq3TyoY+M/ERERtNtgIjbpioDdU/z8FjloQU8jCeop3EyRk5xBUCBRQgW9MX8UPa ffqW5UhL/fLSTOUb23q+o4R39pnFvlSy4ixcT/5e8eELSyM8tJZ3CELRUS+8QTOebhMu qLvA== X-Gm-Message-State: AODbwcBnE4jKevTkfSbc/r6YfDf9gtcWjPlyycTM4LVgNrbcTc5pvnEq k6sZTHcQew8BuQ== X-Received: by 10.55.178.199 with SMTP id b190mr2379035qkf.111.1493814555684; Wed, 03 May 2017 05:29:15 -0700 (PDT) From: To: Kimchi Devel Date: Wed, 3 May 2017 09:29:07 -0300 Message-Id: <20170503122907.4699-1-dhbarboza82@gmail.com> X-Mailer: git-send-email 2.9.3 Subject: [Kimchi-devel] [PATCH] [WoK] Bug fix #217: Fixing select() waking up X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza There was a condition in the close of the Websocket that wasn't being covered properly by the pushserver prior to this patch. The fix was to put an additional condition to close our remote socket reference when we receive no data from it, instead of relying just in the Except call to do it. While we're at it, a cleanup was made in the code to remove a condition of a 'CLOSE' message that was being sent in the first versions of the Pushserver but didn't make upstream. Signed-off-by: Daniel Henrique Barboza --- src/wok/pushserver.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/wok/pushserver.py b/src/wok/pushserver.py index 6cad2cf..8b16f3d 100644 --- a/src/wok/pushserver.py +++ b/src/wok/pushserver.py @@ -108,31 +108,27 @@ class PushServer(object): while self.server_running: read_ready, _, _ =3D select.select(self.connections, [], [], 1) + for sock in read_ready: if not self.server_running: break =20 if sock =3D=3D self.server_socket: - new_socket, addr =3D self.server_socket.accept() self.connections.append(new_socket) else: try: data =3D sock.recv(4096) - except: - try: + if not data: self.connections.remove(sock) - except ValueError: - pass - - continue - if data and data =3D=3D 'CLOSE': - sock.send('ACK') + sock.close() + except: try: self.connections.remove(sock) except ValueError: pass - sock.close() + finally: + sock.close() =20 except Exception as e: raise RuntimeError('Exception ocurred in listen() of pushserve= r ' --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel