[pyopenssl] More exception fixes
This commit is contained in:
parent
5cb241b8c0
commit
236ed0463a
1 changed files with 5 additions and 5 deletions
|
@ -81,10 +81,10 @@ class SSLWrapper:
|
||||||
|
|
||||||
this.exc = exc
|
this.exc = exc
|
||||||
|
|
||||||
this.errno = errno or gattr(this.exc, 'errno', 0)
|
errno = errno or gattr(this.exc, 'errno', 0)
|
||||||
this.strerror = strerror or gattr(this.exc, 'strerror') or gattr(this.exc, 'args')
|
strerror = strerror or gattr(this.exc, 'strerror') or gattr(this.exc, 'args')
|
||||||
|
|
||||||
this.parent.__init__(this, errno, strerror)
|
this.parent.__init__(this, this.errno, this.strerror)
|
||||||
this.peer = peer
|
this.peer = peer
|
||||||
this.exc_name = None
|
this.exc_name = None
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class SSLWrapper:
|
||||||
s += ", Caused by %s" % this.exc_name
|
s += ", Caused by %s" % this.exc_name
|
||||||
if this.exc_str:
|
if this.exc_str:
|
||||||
if this.strerror: s += "(%s)" % this.exc_str
|
if this.strerror: s += "(%s)" % this.exc_str
|
||||||
else: s += "(%s)" % this.exc_args
|
else: s += "(%s)" % str(this.exc_args)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def __init__(this, sslobj, sock=None):
|
def __init__(this, sslobj, sock=None):
|
||||||
|
@ -177,7 +177,7 @@ class PyOpenSSLWrapper(SSLWrapper):
|
||||||
log.debug("Send: " + repr(e))
|
log.debug("Send: " + repr(e))
|
||||||
time.sleep(0.1) # prevent 100% CPU usage
|
time.sleep(0.1) # prevent 100% CPU usage
|
||||||
except OpenSSL.SSL.SysCallError, e:
|
except OpenSSL.SSL.SysCallError, e:
|
||||||
log.error("Recv: Got OpenSSL.SSL.SysCallError: " + repr(e))
|
log.error("Send: Got OpenSSL.SSL.SysCallError: " + repr(e))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise SSLWrapper.Error(this.sock or this.sslobj, e)
|
raise SSLWrapper.Error(this.sock or this.sslobj, e)
|
||||||
except OpenSSL.SSL.Error, e:
|
except OpenSSL.SSL.Error, e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue