Hi All,<br><br>I&#39;ve been thinking of implementing a connection manager in twisted. The app I&#39;m working on has various parts or &quot;modules&quot; that individually make separate connections to various services and what not. They basically act independently of each other - as in they&#39;re all scheduled connection calls and what not.<br>
<br>I&#39;m interested in mediating these connections through a &quot;Dispatcher&quot; of sorts - what I&#39;m thinking would be a thin wrapper over the reactor, with extra state. One of the things the Dispatcher would do is gauge network connection health - something like periodically attempting to ping/connect to well known internet sites. If the connection ever degrades or fails, the Dispatcher would change state. Fairly straightforward, conceptually at least.<br>
<br>My questions are twofold - is the general idea sound - how is such a thing implemented elsewhere? Also, what would be the best strategy to implement the above, if the idea is sane? <br><br>I was thinking something like this: my Dispatcher would have something like a connectTCP call which would in turn call the reactor.connectTCP with a special DispatcherFactory. As the returned IConnector calls startedConnecting on the DispatcherFactory, it would check internal state, figure out a policy and decide whether to continue with the connection and call the passed in factory&#39;s buildProctol, or call the IConnector stopConnecting to pause the connection attempt. If the situation improves later on, the IConnector.connect can be called to &quot;resume&quot; the connection attempt.<br>
<br>Any feedback would be greatly appreciated.<br><br>Thanks,<br>Reza<br clear="all"><br>-- <br>Reza Lotun<br>Senior Software Engineer<br>GetPeer Limited<br><a href="mailto:reza@getpeer.com">reza@getpeer.com</a><br><br><br>