asyncore: suggested patch

Robert Amesz rcameszREMOVETHIS at dds.removethistoo.nl
Sat Jun 2 19:08:12 EDT 2001


Jonathan Feinberg wrote:

> rcameszREMOVETHIS at dds.removethistoo.nl (Robert Amesz) writes:
> 
>> Jonathan Feinberg wrote:
>> 
>>> rcameszREMOVETHIS at dds.removethistoo.nl (Robert Amesz) writes:
>>> 
>>>> If Jonathan Freiberg wants to make his connect-patch work on
>>>> more 
>                ^^^^^^^^
>>>> platforms, notably Windows, he'll have to put in a bit more
>>>> effort. 
>>> 
>>> Hmm.  If Robert Azesm
>> 
>> Congratulations. I never saw anyone garble my last name quite as
>> badly as that. ;-)
> 
> Nor I.  I was dropping you a hint.

Oops. Too subtle, I'm afraid. Try whacking me on the head with a mallet 
next time.


>> The added select() in your connection function will *block* the
>> system. This means that during a long wait for a connection to be
>> established (or time out) asyncore totally grinds to a halt.
> 
> This is, in fact, how asyncore currently behaves, *without* my
> patch.  My patch is intended to *address* this behavior.


It blocks in the sense that calling the loop() function doesn't return, 
of course. It also blocks in the sense that if a connection can't be 
made asyncore will never call any handler function for that dispatch 
object (socket). It will, however, continue to manage all the dispatch 
objects it's supposed to manage. Your patch disrupts that processing.

The best solution is to extend asyncore to generate timeout events, and 
call appropriate handler functions if those occur. It's not trivial, 
but it shouldn't be too hard either.


Robert Amesz



More information about the Python-list mailing list