From c4a720aa8966b3398fff551143d75530139cda72 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 13 Jul 2009 17:47:20 +0200 Subject: [PATCH] handle ZeroReturnError raised by PyOpenSSL --- src/common/xmpp/tls_nb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/xmpp/tls_nb.py b/src/common/xmpp/tls_nb.py index cde9d4c43..b04e7ad00 100644 --- a/src/common/xmpp/tls_nb.py +++ b/src/common/xmpp/tls_nb.py @@ -165,6 +165,10 @@ class PyOpenSSLWrapper(SSLWrapper): log.debug("Recv: Got OpenSSL.SSL.SysCallError: " + repr(e), exc_info=True) raise SSLWrapper.Error(self.sock or self.sslobj, e) + except OpenSSL.SSL.ZeroReturnError, e: + # end-of-connection raises ZeroReturnError instead of having the + # connection's .recv() method return a zero-sized result. + raise SSLWrapper.Error(self.sock or self.sslobj, e, -1) except OpenSSL.SSL.Error, e: if self.is_numtoolarge(e): # warn, but ignore this exception