summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexandernst <>2011-05-28 21:36:47 -0400
committerLouis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk>2011-05-28 21:36:47 -0400
commit333839f829b2161b21052d54693ebf7264d2b3bc (patch)
tree37ed2b2f0fa4eead461bddb93819c908ee42aab3
parent7f2c9426a434a7197f6272afafa7f5d86a1aeca1 (diff)
bugfix: don't close connection when receiving an IN event with empty buffer
-rw-r--r--papyon/gnet/io/sock.py5
-rw-r--r--papyon/gnet/io/ssl_socket.py5
2 files changed, 5 insertions, 5 deletions
diff --git a/papyon/gnet/io/sock.py b/papyon/gnet/io/sock.py
index 95b8963..15825ba 100644
--- a/papyon/gnet/io/sock.py
+++ b/papyon/gnet/io/sock.py
@@ -70,11 +70,10 @@ class SocketClient(GIOChannelClient):
try:
buf = self._channel.read(2048)
except gobject.GError:
- pass
- if buf == "":
self.close()
return False
- self.emit("received", buf, len(buf))
+ if buf != "":
+ self.emit("received", buf, len(buf))
# Check for error/EOF
if cond & (gobject.IO_ERR | gobject.IO_HUP):
diff --git a/papyon/gnet/io/ssl_socket.py b/papyon/gnet/io/ssl_socket.py
index 5194317..cb7f25e 100644
--- a/papyon/gnet/io/ssl_socket.py
+++ b/papyon/gnet/io/ssl_socket.py
@@ -81,10 +81,11 @@ class SSLSocketClient(GIOChannelClient):
buf = ""
while True:
buf = self._transport.recv(2048)
- self.emit("received", buf, len(buf))
+ if buf != "":
+ self.emit("received", buf, len(buf))
except (OpenSSL.WantX509LookupError,
OpenSSL.WantReadError, OpenSSL.WantWriteError):
- return True
+ pass
except OpenSSL.Error:
self.close()
return False