mirror of https://github.com/python/cpython
Update example of non-blocking SSL code for the new finer-grained exceptions
This commit is contained in:
parent
41032a69c1
commit
873bf262ad
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue