From fa25bfc7974fdb780f485b4da0e3e5c52142d630 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 25 May 2019 12:27:42 -0400 Subject: [PATCH] more strict connection timeouts --- llarp/utp/linklayer.cpp | 2 +- llarp/utp/session.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/llarp/utp/linklayer.cpp b/llarp/utp/linklayer.cpp index 61ee366aa..e27b0a98f 100644 --- a/llarp/utp/linklayer.cpp +++ b/llarp/utp/linklayer.cpp @@ -330,7 +330,7 @@ namespace llarp const AddressInfo& addr) { return std::make_shared< OutboundSession >( - this, utp_create_socket(_utp_ctx), rc, addr); + this, NewSocket(), rc, addr); } uint64 diff --git a/llarp/utp/session.cpp b/llarp/utp/session.cpp index 4d79414d8..a75cc8de8 100644 --- a/llarp/utp/session.cpp +++ b/llarp/utp/session.cpp @@ -194,10 +194,12 @@ namespace llarp bool Session::TimedOut(llarp_time_t now) const { - if(state == eInitial || state == eLinkEstablished) - return false; + if(state == eConnecting) + return now - lastActive > 5000; if(sendq.size() >= MaxSendQueueSize) { + if(now <= lastSend) + return false; return now - lastSend > 5000; } // let utp manage this