summaryrefslogtreecommitdiff
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-24 19:57:01 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-24 19:57:01 +0000
commit4d3e372ff3f611aa76458a48f26ec4701315c128 (patch)
tree17bc0c1472cf2d773be57c6581f3054b069b0d16 /Modules/_ssl.c
parent5fa9fb40621b3963beef9d58388bb0616e0d8de9 (diff)
downloadcpython-git-4d3e372ff3f611aa76458a48f26ec4701315c128.tar.gz
The do_handshake() method of SSL objects now adjusts the blocking mode of
the SSL structure if necessary (as other methods already do).
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index d19bf2d488..e81c219dbb 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -455,7 +455,12 @@ static PyObject *PySSL_SSLdo_handshake(PySSLObject *self)
{
int ret;
int err;
- int sockstate;
+ int sockstate, nonblocking;
+
+ /* just in case the blocking state of the socket has been changed */
+ nonblocking = (self->Socket->sock_timeout >= 0.0);
+ BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking);
+ BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking);
/* Actually negotiate SSL connection */
/* XXX If SSL_do_handshake() returns 0, it's also a failure. */