On Mon, Dec 22, 2003 at 07:23:45PM -0500, David Bolen wrote:
I've been experimenting with the perspective broker in Twisted 1.1.0 and am wondering? Is there any graceful way to reconnect and continue to use PB references if you temporarily lose a connection due to a network outage?
PB references are managed by the connection's Broker object, which is created anew in the factory's buildProtocol method, and the object/reference cache of which is cleared when connections are lost.
Having references which can withstand disconnects should be doable relatively easily - all you need to do is make sure the same Broker objects get used for all subsequent reconnections. This may be a little tricky, since you need to differentiate between new connections and reconnections (which you can't do easily with PB, because you'll already have a Broker), but should be entirely possible.
I'm not sure if there is any reason, other than trickiness factor, that this isn't implemented directly in twisted.spread. Perhaps there is a hidden issue I am unaware of, or maybe it is simply that no one has wanted it badly enough to write it :)
Hope this helps,