[Python-checkins] python/dist/src/Modules socketmodule.c,1.239,1.240

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年8月06日 15:25:05 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv20543/python/Modules
Modified Files:
	socketmodule.c 
Log Message:
internal_connect(): Windows. When sock_timeout > 0 and connect() yields
WSAEWOULDBLOCK, the second connect() attempt appears to yield WSAEISCONN
on Win98 but WSAEINVAL on Win2K. So accept either as meaning "yawn,
fine". This allows test_socket to succeed on my Win2K box (which it
already did on my Win98SE box).
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.239
retrieving revision 1.240
diff -C2 -d -r1.239 -r1.240
*** socketmodule.c	2 Aug 2002 02:27:13 -0000	1.239
--- socketmodule.c	6 Aug 2002 22:25:02 -0000	1.240
***************
*** 1306,1311 ****
 			internal_select(s, 1);
 			res = connect(s->sock_fd, addr, addrlen);
! 			if (res < 0 && WSAGetLastError() == WSAEISCONN)
! 				res = 0;
 		}
 	}
--- 1306,1319 ----
 			internal_select(s, 1);
 			res = connect(s->sock_fd, addr, addrlen);
! 			if (res < 0) {
! 				/* On Win98, WSAEISCONN was seen here. But
! 				 * on Win2K, WSAEINVAL. So accept both as
! 				 * meaning "fine".
! 				 */
! 				int code = WSAGetLastError();
! 				if (code == WSAEISCONN ||
! 				 code == WSAEINVAL)
! 					res = 0;
! 			}
 		}
 	}
***************
*** 2496,2504 ****
 					 "long int larger than 32 bits");
 			x = y;
! 		}			
 #endif
 	}
 	else
! 		return PyErr_Format(PyExc_TypeError, 
 				 "expected int/long, %s found",
 				 arg->ob_type->tp_name);
--- 2504,2512 ----
 					 "long int larger than 32 bits");
 			x = y;
! 		}
 #endif
 	}
 	else
! 		return PyErr_Format(PyExc_TypeError,
 				 "expected int/long, %s found",
 				 arg->ob_type->tp_name);
***************
*** 2555,2563 ****
 					 "long int larger than 32 bits");
 			x = y;
! 		}			
 #endif
 	}
 	else
! 		return PyErr_Format(PyExc_TypeError, 
 				 "expected int/long, %s found",
 				 arg->ob_type->tp_name);
--- 2563,2571 ----
 					 "long int larger than 32 bits");
 			x = y;
! 		}
 #endif
 	}
 	else
! 		return PyErr_Format(PyExc_TypeError,
 				 "expected int/long, %s found",
 				 arg->ob_type->tp_name);

AltStyle によって変換されたページ (->オリジナル) /