From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
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 <danielhb@linux.vnet.ibm.com>
---
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, _, _ = select.select(self.connections,
[], [], 1)
+
for sock in read_ready:
if not self.server_running:
break
if sock == self.server_socket:
-
new_socket, addr = self.server_socket.accept()
self.connections.append(new_socket)
else:
try:
data = sock.recv(4096)
- except:
- try:
+ if not data:
self.connections.remove(sock)
- except ValueError:
- pass
-
- continue
- if data and data == 'CLOSE':
- sock.send('ACK')
+ sock.close()
+ except:
try:
self.connections.remove(sock)
except ValueError:
pass
- sock.close()
+ finally:
+ sock.close()
except Exception as e:
raise RuntimeError('Exception ocurred in listen() of pushserver '
--
2.9.3
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
Applied. Thanks. Regards, Aline Manera _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
© 2016 - 2024 Red Hat, Inc.