chiark / gitweb /
svc/watch.in: Check that the crypto is working in adopted peers.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 9 May 2010 11:36:30 +0000 (12:36 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 9 May 2010 14:07:58 +0000 (15:07 +0100)
Previously we only checked for transport.  This can leave a duff peer
running without being fixed.  The downside is that this may end up
repeatedly kicking a no-hoper connection.  Treat crypto setup failure as
grounds for reconnection.

svc/watch.in

index be184b474d21b83ee31dcf827292e0bc316d31ac..995ac500b8b341d32a61afe0fa800b6453bf5ff5 100644 (file)
@@ -399,7 +399,7 @@ class PingPeer (object):
     """
     S.rawcommand(T.TripeAsynchronousCommand(
       me._q, (me._peer, me.seq),
-      ['PING',
+      ['EPING',
        '-background', S.bgtag(),
        '-timeout', str(me._timeout),
        '--',
@@ -432,8 +432,12 @@ class PingPeer (object):
       me._ping()
     elif code == 'FAIL':
       S.notify('watch', 'ping-failed', me._peer, *stuff)
-      if stuff and stuff[0] == 'unknown-peer':
+      if not stuff:
+        pass
+      elif stuff[0] == 'unknown-peer':
         me._pinger.kill(me._peer)
+      elif stuff[0] == 'ping-send-failed':
+        me._reconnect()
     elif code == 'INFO':
       if stuff[0] == 'ping-ok':
         if me._failures > 0: