Hi All,<br><br>I've been thinking of implementing a connection manager in twisted. The app I'm working on has various parts or "modules" that individually make separate connections to various services and what not. They basically act independently of each other - as in they're all scheduled connection calls and what not.<br>
<br>I'm interested in mediating these connections through a "Dispatcher" of sorts - what I'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'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 "resume" 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>