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

Ivo van der Wijk ivo at amaze.nl
Sat Jun 15 19:06:51 EDT 2002


On Sat, Jun 15, 2002 at 06:04:29PM +0200, Itamar Shtull-Trauring wrote:
> 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?

Some people don't see a point in providing these errors, so I'll illustrate
the issue with some more examples:

when binding to a local port, I'd like to know if it fails due to 
the port already being in use (EBUSY), permission denied (i.e. a port
< 1024 when not being root), or some system failure that may be 
difficult to track down without an appropriate error (i.e. running out
of fd's)

I agree with itamar that if these errors aren't handled in the protocol
implementation, failure to connect shouldn't be there either.

	Ivo

-- 
Drs. I.R. van der Wijk                                      -=-              
Brouwersgracht 132                             Amaze Internet Services V.O.F.
1013 HA Amsterdam, NL                                       -=-              
T +31-20-4688336         F +31-20-4688337        Linux/Web/Zope/SQL/MMBase   
W http://www.amaze.nl    E info at amaze.nl             Network Solutions        
W http://vanderwijk.info E ivo at amaze.nl                 Consultancy          
PGP http://vanderwijk.info/pgp                              -=-              




More information about the Twisted-Python mailing list