From: Mark Wooding Date: Sun, 9 May 2010 11:36:30 +0000 (+0100) Subject: svc/watch.in: Check that the crypto is working in adopted peers. X-Git-Tag: 1.0.0pre8~4 X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/commitdiff_plain/474ac4c5badb68ee2f2380d94d80ee864afc1ef8 svc/watch.in: Check that the crypto is working in adopted peers. 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. --- diff --git a/svc/watch.in b/svc/watch.in index be184b47..995ac500 100644 --- a/svc/watch.in +++ b/svc/watch.in @@ -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: