changeset 830:a7fba43c2c6a

Make players attempt to reconnect if connection fails. It is only if the initial connection fails that they will reconnect, if the connection fails in the middle of a protocol run they will still crash. This is probably the right thing to do since we generally wouldn't know how to recover from a crashed protocol. This allows the players to be started in any order and is thus a fix for Issue 8.
author Martin Geisler <>
date Sun, 13 Jul 2008 23:38:22 +0200
parents 405569e5cb96
children 889882a2798b
files viff/
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/viff/	Sun Jul 13 17:04:42 2008 +0200
+++ b/viff/	Sun Jul 13 23:38:22 2008 +0200
@@ -48,7 +48,7 @@
 from twisted.internet.error import ConnectionDone
 from twisted.internet.defer import Deferred, DeferredList, gatherResults, succeed
 from twisted.internet.defer import maybeDeferred
-from twisted.internet.protocol import ClientFactory, ServerFactory
+from twisted.internet.protocol import ReconnectingClientFactory, ServerFactory
 from twisted.protocols.basic import Int16StringReceiver
@@ -319,7 +319,7 @@
-class ShareExchangerFactory(ServerFactory, ClientFactory):
+class ShareExchangerFactory(ReconnectingClientFactory, ServerFactory):
     """Factory for creating ShareExchanger protocols."""
     protocol = ShareExchanger
@@ -340,8 +340,6 @@
     def clientConnectionLost(self, connector, reason):
-    def clientConnectionFailed(self, connector, reason):
-        print "Client connection failed:", reason
 def increment_pc(method):
     """Make *method* automatically increment the program counter.