add a try/except

This commit is contained in:
Yann Leboulanger 2012-08-22 14:49:44 +02:00
parent f832900d2b
commit 5178543517
1 changed files with 22 additions and 17 deletions

View File

@ -1140,6 +1140,7 @@ class Socks5Server(Socks5):
self.disconnect() self.disconnect()
return return
self.idlequeue.remove_timeout(self.fd) self.idlequeue.remove_timeout(self.fd)
try:
if self.state == 2: # send reply with desired auth type if self.state == 2: # send reply with desired auth type
self.send_raw(self._get_auth_response()) self.send_raw(self._get_auth_response())
elif self.state == 4: # send positive response to the 'connect' elif self.state == 4: # send positive response to the 'connect'
@ -1160,6 +1161,10 @@ class Socks5Server(Socks5):
return return
else: else:
self.disconnect() self.disconnect()
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
OpenSSL.SSL.WantX509LookupError), e:
log.info('caught SSL exception, ignored')
return
if self.state < 5: if self.state < 5:
self.state += 1 self.state += 1
# unplug and plug this time for reading # unplug and plug this time for reading