p2p: exponential backoff on reconnect. closes #939

This commit is contained in:
Ethan Buchman
2017-12-11 13:41:09 -05:00
parent f1ca2b3a3a
commit 5511bd8e85
2 changed files with 78 additions and 33 deletions

View File

@@ -272,10 +272,10 @@ func TestSwitchReconnectsToPersistentPeer(t *testing.T) {
// simulate failure by closing connection
peer.CloseConn()
// TODO: actually detect the disconnection and wait for reconnect
// TODO: remove sleep, detect the disconnection, wait for reconnect
npeers := sw.Peers().Size()
for i := 0; i < 20; i++ {
time.Sleep(100 * time.Millisecond)
time.Sleep(250 * time.Millisecond)
npeers = sw.Peers().Size()
if npeers > 0 {
break