[Twisted-Python] Proposal: changes to reactor.clientTCP

Itamar Shtull-Trauring twisted at itamarst.org
Sat Jun 15 12:04:29 EDT 2002


Background:
Ivo pointed out there's no way to differentiate between "no such 
hostname" and "connection refused". For that matter, connectionFailed 
has nothing to do with the protocol - why are we doing a callback on the 
protocol at all? It shouldn't be created if no connection was made.

Proposal:
reactor.clientTCP accepts a protocol factory instead of a protocol, and 
only makes a protocol instance if connection was made. Additionally, it 
accepts an additional argument, failureCallback, which will get called 
with a status code (CONNECTION_REFUSED, NO_SUCH_HOSTNAME) or something 
when the connection fails. Protocol.connectionFailed goes bye-bye.

Comments?





More information about the Twisted-Python mailing list