diff Modules/socketmodule.c @ 23727:9d11f51860dd legacy-trunk

I decided to change the interaction between setblocking() and settimeout(). Already, settimeout() canceled non-blocking mode; now, setblocking() also cancels the timeout. This is easier to document. (XXX should settimeout(0) be an alias for setblocking(0)? They seem to have roughly the same effect. Also, I'm not sure that the code in connect() and accept() is correct in all cases. We'll sort this out soon enough.)
author Guido van Rossum <guido@python.org>
date Fri, 07 Jun 2002 03:36:20 +0000
parents 1235a95fedcd
children 1842db6a1394
line wrap: on
line diff
--- a/Modules/socketmodule.c	Fri Jun 07 03:26:43 2002 +0000
+++ b/Modules/socketmodule.c	Fri Jun 07 03:36:20 2002 +0000
@@ -1086,11 +1086,8 @@
 		return NULL;
 
 	s->sock_blocking = block;
-
-	/* If we're not using timeouts, actually set the blocking to give
-	   old python behavior. */
-	if (s->sock_timeout < 0.0)
-		internal_setblocking(s, block);
+	s->sock_timeout = -1.0; /* Always clear the timeout */
+	internal_setblocking(s, block);
 
 	Py_INCREF(Py_None);
 	return Py_None;