[Python-checkins] python/dist/src/Modules socketmodule.c,1.222,1.223

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 06 Jun 2002 20:36:23 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv16461

Modified Files:
	socketmodule.c 
Log Message:
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.)


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -C2 -d -r1.222 -r1.223
*** socketmodule.c	7 Jun 2002 03:19:37 -0000	1.222
--- socketmodule.c	7 Jun 2002 03:36:20 -0000	1.223
***************
*** 1087,1095 ****
  
  	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);
  
  	Py_INCREF(Py_None);
--- 1087,1092 ----
  
  	s->sock_blocking = block;
! 	s->sock_timeout = -1.0; /* Always clear the timeout */
! 	internal_setblocking(s, block);
  
  	Py_INCREF(Py_None);