[Python-Dev] timeoutsocket.py

Bernard Yue bernie@3captus.com
Fri, 03 May 2002 01:49:02 -0600


Timothy O'Malley wrote:
> 
> hola.
> 
> I've taken a whack at option #1 (grand unification of socket and
> timeoutsocket).
> 
> It's larger than I'd prefer to send in email.  If you are interested:
> 
>   http://www.timo-tasi.org/python/socket.py
> 
> --
> TimO
>

Tim, this is a complete rewrite of timeoutsocket.py.  It is quite an
effort :)

> 1.  Shall we merge socket.py and timeoutsocket.py?
>
> It certainly is possible to merge TimeoutSocket and _socketobject.
> If the merge was done in a straightforward manner, then every TCP
> socket would use Python code (instead of C code) for recv() and 
> send() methods.  Some might consider this an unacceptable performance
> hit.

I agree on the performance issue.  Over the past two weeks, Michael
Gilfix and I moved ahead with the implementing of timeout socket in C
level.  Michael translates what you've done in timeoutsocket.py and put
it into socket.c.  So far we did nothing to TimeoutFile.  The proposed
patch is basically done (except for the test case).  You can find it on
http://www.3captus.com/Downloads/.

We are now working on the test case for connect() and sendfoo(). 
Currently, test for connect() is done by trying a timeout connect to an
external site (same to what you've done).  However, we wanted to remove
the external dependency on standard python test suit.  So far no luck of
make it working, and I cannot make sendfoo() to raise timeout error at
all.

Would you like to help us with the test?


Bernie

-- 
There are three schools of magic.  One:  State a tautology, then ring
the changes on its corollaries; that's philosophy.  Two:  Record many
facts.  Try to find a pattern.  Then make a wrong guess at the next
fact; that's science.  Three:  Be aware that you live in a malevolent
Universe controlled by Murphy's Law, sometimes offset by Brewster's
Factor; that's engineering.
                -- Robert A. Heinlein