diff Modules/_ssl.c @ 60932:a09d7f414cd1 legacy-trunk

The do_handshake() method of SSL objects now adjusts the blocking mode of the SSL structure if necessary (as other methods already do).
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 24 Apr 2010 19:57:01 +0000
parents c9a32edd2ba7
children 448ef900081c
line wrap: on
line diff
--- a/Modules/_ssl.c	Sat Apr 24 17:10:22 2010 +0000
+++ b/Modules/_ssl.c	Sat Apr 24 19:57:01 2010 +0000
@@ -455,7 +455,12 @@
 {
 	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. */