[Twisted-Python] ReconnectingClientFactory creates multiple Protocols?

mikah at ceruleansoftware.com mikah at ceruleansoftware.com
Thu Sep 15 01:32:18 EDT 2005


Hello --

  My network app consists of a ReconnectingClientFactory whose
Protocol instances connect to a another server. The protocol
class logs its activities to a file. Each transaction has a
unique number that increments.

  As far as I can tell, it works perfectly, with one strange
quirk. If I leave the app running for several days, I start
seeing more than one protocol showing up in the logs. I can
tell that it's not the same protocol since there's more than
one sequence of transaction numbers incrementing.

  As far as I can tell, it's related to the connection being
dropped, at which point the Factory reconnects and creates a
new protocol instance.

  What might I be doing wrong? It's buildProtocol() that
creates the new instances, but shouldn't the previous instance
get disconnected and cleaned up somehow? How can I ensure
this?

  Is it possible to force a protocol to disconnect and get
deleted? Which class (app, service, factory, protocol) should
be responsible?

  Thanks in advance,

mikah






More information about the Twisted-Python mailing list