[issue13694] asynchronous connect in asyncore.dispatcher does not set addr
Matt Joiner
report at bugs.python.org
Tue Jan 3 01:42:50 CET 2012
Matt Joiner <anacrolix at gmail.com> added the comment:
I don't believe it is. dispatcher.addr is only set if the connection is immediately established. It's set explicitly in dispatcher.__init__ if a socket is provided that is already connected. It's *not* set after a connection completes.
There are 2 solutions as I see it:
1) Set addr after a successful call to socket.connect indicates that a connection is being established. Currently this only occurs if the connection is not delayed.
2) Set the addr when a connect event completes. This would require making getpeername calls like in dispatcher.__init__ and would be significantly more expensive.
My patch implements method 1. This conforms to existing addr-setting behaviour in dispatcher.bind.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13694>
_______________________________________
More information about the Python-bugs-list
mailing list