From 783c0c7c7ba63db4b9773add67ed73c1754cc14e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 3 Sep 2016 15:53:28 -0400 Subject: [PATCH] update datagram lease selection --- Datagram.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Datagram.cpp b/Datagram.cpp index 1a97afc5..3d5dec8b 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -341,9 +341,16 @@ namespace datagram } else if (routingPath) { - // stick with the lease we have if we have one - lease = routingPath->remoteLease; + if(routingPath->remoteLease) + { + if(routingPath->remoteLease->ExpiresSoon()) + lease = GetNextLease(); + else + lease = routingPath->remoteLease; + } } + else + lease = GetNextLease(); if(lease) { // we have a valid lease to use and an outbound tunnel @@ -408,6 +415,8 @@ namespace datagram uint32_t idx = rand() % leases.size(); next = leases[idx]; } + else + LogPrint(eLogWarning, "DatagramDestination: no leases to use"); } return next; }