homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: no address in the representation of asyncore dispatcher after connection established
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, josiahcarlson, stutzbach, xdegaye
Priority: normal Keywords: patch

Created on 2011年11月02日 16:55 by xdegaye, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dispatcher_addr.py xdegaye, 2011年11月02日 16:55
dispatcher_addr.diff xdegaye, 2011年11月02日 16:56 review
Messages (2)
msg146849 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2011年11月02日 16:55
When an asyncore dispatcher initiates a tcp connection, its
representation lacks the peer address. The output of the attached
script 'dispatcher_addr.py' gives on linux with Python 3.2:
call stack in handle_connect_event:
<module>->main->loop->poll->write->handle_write_event->handle_connect_event
self.addr after connection: None
The attached patch fixes the problem. The patch includes a test case.
The following comment in the patch:
 # EWOULDBLOCK may also be returned by winsock when calling connect
 # while the connection attempt is in progress
refers to the following statement in
http://msdn.microsoft.com/en-us/library/aa923167.aspx
"""
As a result, it is not recommended that applications use multiple
calls to connect to detect connection completion. If they do, they
must be prepared to handle WSAEINVAL and WSAEWOULDBLOCK error codes
the same way that they handle WSAEALREADY to ensure robust execution.
"""
Note that two consecutive calls to
socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) are made when
handle_write_event() is called and self.connected is False: one in
handle_write_event and the following right away in
handle_connect_event. This seems useless.
msg156563 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012年03月22日 14:25
Closing as duplicate of issue 13694.
History
Date User Action Args
2022年04月11日 14:57:23adminsetgithub: 57534
2012年03月22日 14:25:29giampaolo.rodolasetstatus: open -> closed
resolution: duplicate
messages: + msg156563

versions: + Python 2.7
2011年11月03日 01:58:41pitrousetnosy: + josiahcarlson, giampaolo.rodola, stutzbach
stage: patch review

versions: + Python 3.3
2011年11月02日 16:56:16xdegayesetfiles: + dispatcher_addr.diff
keywords: + patch
2011年11月02日 16:55:39xdegayesetfiles: + dispatcher_addr.py
2011年11月02日 16:55:01xdegayecreate

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