From 0b090b671afd1fef0ecac2975f0518f1dafdef36 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 1 Jul 2019 14:06:17 -0400 Subject: [PATCH] relax timeouts for handshake and make format --- llarp/utp/session.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/llarp/utp/session.cpp b/llarp/utp/session.cpp index 309ce14c5..b1cfcfdf8 100644 --- a/llarp/utp/session.cpp +++ b/llarp/utp/session.cpp @@ -82,7 +82,7 @@ namespace llarp { OnLinkEstablished(p); metrics::integerTick("utp.session.open", "to", 1, "id", - RouterID(remoteRC.pubkey).ToString()); + RouterID(remoteRC.pubkey).ToString()); OutboundHandshake(); } @@ -193,9 +193,16 @@ namespace llarp return true; if(state == eConnecting) return now - lastActive > 5000; - if(now <= lastSend) - return false; - return now - lastSend > 30000; + if(state == eSessionReady) + { + if(now <= lastSend) + return false; + return now - lastSend > 30000; + } + if(state == eLinkEstablished) + return now - lastActive + > 10000; /// 10 second timeout for the whole handshake + return true; } PubKey @@ -591,7 +598,7 @@ namespace llarp if(remoteRC.IsPublicRouter()) { metrics::integerTick("utp.session.close", "to", 1, "id", - RouterID(remoteRC.pubkey).ToString()); + RouterID(remoteRC.pubkey).ToString()); } } }