From 39d9e64ee59d7fdd30fb3c09ad009d80cfe76fde Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 16 Feb 2016 11:43:06 -0800 Subject: [PATCH] process a handshake if the connection has ever received data --- libraries/networking/src/udt/Connection.cpp | 6 +++--- libraries/networking/src/udt/Connection.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index f733d58869..0e1f3ddefb 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -411,7 +411,7 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in return false; } - _isReceivingData = true; + _isReceivingData = _hasReceivedData = true; // mark our last receive time as now (to push the potential expiry farther) _lastReceiveTime = p_high_resolution_clock::now(); @@ -725,7 +725,7 @@ void Connection::processNAK(std::unique_ptr controlPacket) { void Connection::processHandshake(std::unique_ptr controlPacket) { - if (!_hasReceivedHandshake || _isReceivingData) { + if (!_hasReceivedHandshake || _hasReceivedData) { // server sent us a handshake - we need to assume this means state should be reset // as long as we haven't received a handshake yet or we have and we've received some data resetReceiveState(); @@ -799,7 +799,7 @@ void Connection::resetReceiveState() { // the _nakInterval need not be reset, that will happen on loss // clear sync variables - _isReceivingData = false; + _isReceivingData = _hasReceivedData = false; _connectionStart = p_high_resolution_clock::now(); _acksDuringSYN = 1; diff --git a/libraries/networking/src/udt/Connection.h b/libraries/networking/src/udt/Connection.h index bf56a468aa..2f2252a139 100644 --- a/libraries/networking/src/udt/Connection.h +++ b/libraries/networking/src/udt/Connection.h @@ -129,6 +129,7 @@ private: p_high_resolution_clock::time_point _lastReceiveTime; // holds the last time we received anything from sender bool _isReceivingData { false }; // flag used for expiry of receipt portion of connection + bool _hasReceivedData { false }; // flag used for reset of connection state on second handshake bool _isActive { true }; // flag used for inactivity of connection SequenceNumber _initialReceiveSequenceNumber; // Randomized by peer SendQueue on creation, identifies connection during re-connect requests