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.

Author jjdmol
Recipients
Date 2005-11-30.21:18:48
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
suppose you have a socket handled by your asynchat.async_chat class 
and want to send a message (call push()). push() calls initiate_send(), 
which can call handle_error() if an error occurs. however, once 
handle_error() returns, the control is passed back to push(), which has 
no return value thus cannot signal the success or failure to the code 
that did the push(). i.e. if we have code like

foo()
s.push(data)
bar()

the following is executed in case of an error:

foo()
s.push(data)
s.handle_error()
bar()

this created an obscure bug, as the bar() assumed the send() always 
succeeds, and also cannot check directly by the result of push() if it 
did. this creates the false illusion push() can never fail.

to avoid this, handle_error() can set a flag, which can be checked after 
the push(). however, this is an ugly hack of course.

PS: send() can easily fail. suppose we're reading from 2 sockets: A and 
B, and send messages to both when data is read from either one. if B 
gets disconnected and A has data ready, both will be in the set of 
readible sockets returned by select(). if A's data is handled before B's, 
and A sends a message to B, this will cause the send to fail as B is 
disconnected. your app wont know B failed, because this is processed 
after the data from A is processed.
History
Date User Action Args
2007-08-23 14:36:28adminlinkissue1370380 messages
2007-08-23 14:36:28admincreate