[Python-Dev] Socket timeout patch
Guido van Rossum
Wed, 05 Jun 2002 17:33:55 -0400
> Ok. Done. One day, you can explain to me why you despise whitespace
> so. Perhaps she was mean to you or something. She's always hanging
> around with that tab guy at any rate and they make a bad mix.
I like the whitespace use in the English language (like so) best.
> Ok. This has been fixed. All read sizes now work and have been tested
> by me.
Have you written unit tests? That would be really great. Ideally,
the tests should pass both before and after your patches.
> So, the best way to proceed seems to be:
> if (s->sock_timeout == Py_None)
> /* Perhaps do nothing, or just do original behavior */
> /* Get funky. Do one of the solutions discussed below */
> So here are the new semantics:
> If you set_timeout(int/float/long != None):
> The actual socket gets put in non-blocking mode and the usual select
> stuff is done.
> If you set_timeout(None):
> The old behavior is used AND automatically, the socket is set
> to blocking mode. That means that someone who was doing non-blocking
> stuff before, sets a timeout, and then unsets one, will have to do
> a set_blocking call again if he wants non-blocking stuff. This makes
> sense 'cause timeout stuff is blocking by nature.
--Guido van Rossum (home page: http://www.python.org/~guido/)