[Twisted-Python] client API issue for Application

Itamar Shtull-Trauring twisted at itamarst.org
Mon Aug 26 11:32:05 EDT 2002


Christopher Armstrong wrote:

> I've been talking with nobomb on #twisted about his IRC bot, which he
> wants to be able to connect to a list of servers for fail-over (i.e.,
> when one server connection fails, try to connect to the nest). We worked
> it out so that he'd call app.connectTCP again in his
> clientConnectionFailed method of his ClientFactory, but I realized that
> the tcpConnectors list in Application *never* gets cleaned out. Should
> we have an explicit method to do this, or some kind of automatic
> cleaning, or something...?

If you don't want a connection to persist, don't add it to Application. 
Since a connection to an IRC server shouldn't persist (you may be connecting 
to other servers), it should be added to reactor directly. Since you 
apparently want *something* to persist, you probably want to add a 
twisted.internet.app.ApplicationService that will manage the connections.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
Available for Python, Twisted, Zope and Java consulting





More information about the Twisted-Python mailing list