Update example of non-blocking SSL code for the new finer-grained exceptions

This commit is contained in:
Antoine Pitrou 2011-10-27 23:59:03 +02:00
parent 41032a69c1
commit 873bf262ad
1 changed files with 4 additions and 7 deletions

View File

@ -1044,13 +1044,10 @@ to be aware of:
try:
sock.do_handshake()
break
except ssl.SSLError as err:
if err.args[0] == ssl.SSL_ERROR_WANT_READ:
select.select([sock], [], [])
elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
select.select([], [sock], [])
else:
raise
except ssl.SSLWantReadError:
select.select([sock], [], [])
except ssl.SSLWantWriteError:
select.select([], [sock], [])
.. _ssl-security: