Merge pull request #5788 from birarda/master

make node timeout less brittle (by giving it more time)
This commit is contained in:
Ryan Huffman 2015-09-11 16:59:04 -07:00
commit 2bb633d370
5 changed files with 20 additions and 20 deletions

View file

@ -43,7 +43,7 @@
#include "udt/Socket.h" #include "udt/Socket.h"
#include "UUIDHasher.h" #include "UUIDHasher.h"
const quint64 NODE_SILENCE_THRESHOLD_MSECS = 2 * 1000; const quint64 NODE_SILENCE_THRESHOLD_MSECS = 5 * 1000;
extern const char SOLO_NODE_TYPES[2]; extern const char SOLO_NODE_TYPES[2];

View file

@ -81,9 +81,9 @@ SendQueue& Connection::getSendQueue() {
// Lasily create send queue // Lasily create send queue
_sendQueue = SendQueue::create(_parentSocket, _destination); _sendQueue = SendQueue::create(_parentSocket, _destination);
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Created SendQueue for connection to" << _destination; qCDebug(networking) << "Created SendQueue for connection to" << _destination;
#endif #endif
QObject::connect(_sendQueue.get(), &SendQueue::packetSent, this, &Connection::packetSent); QObject::connect(_sendQueue.get(), &SendQueue::packetSent, this, &Connection::packetSent);
QObject::connect(_sendQueue.get(), &SendQueue::packetSent, this, &Connection::recordSentPackets); QObject::connect(_sendQueue.get(), &SendQueue::packetSent, this, &Connection::recordSentPackets);
@ -103,14 +103,14 @@ void Connection::queueInactive() {
// tell our current send queue to go down and reset our ptr to it to null // tell our current send queue to go down and reset our ptr to it to null
stopSendQueue(); stopSendQueue();
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Connection to" << _destination << "has stopped its SendQueue."; qCDebug(networking) << "Connection to" << _destination << "has stopped its SendQueue.";
#endif #endif
if (!_hasReceivedHandshake || !_isReceivingData) { if (!_hasReceivedHandshake || !_isReceivingData) {
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Connection SendQueue to" << _destination << "stopped and no data is being received - stopping connection."; qCDebug(networking) << "Connection SendQueue to" << _destination << "stopped and no data is being received - stopping connection.";
#endif #endif
emit connectionInactive(_destination); emit connectionInactive(_destination);
} }
@ -167,9 +167,9 @@ void Connection::sync() {
// otherwise we'll wait for it to also timeout before cleaning up // otherwise we'll wait for it to also timeout before cleaning up
if (!_sendQueue) { if (!_sendQueue) {
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Connection to" << _destination << "no longer receiving any data and there is currently no send queue - stopping connection."; qCDebug(networking) << "Connection to" << _destination << "no longer receiving any data and there is currently no send queue - stopping connection.";
#endif #endif
emit connectionInactive(_destination); emit connectionInactive(_destination);
} }
@ -203,10 +203,10 @@ void Connection::sync() {
// it's been CONNECTION_NOT_USED_EXPIRY_SECONDS and nothing has actually happened with this connection // it's been CONNECTION_NOT_USED_EXPIRY_SECONDS and nothing has actually happened with this connection
// consider it inactive and emit our inactivity signal // consider it inactive and emit our inactivity signal
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Connection to" << _destination << "did not receive or send any data in last" qCDebug(networking) << "Connection to" << _destination << "did not receive or send any data in last"
<< CONNECTION_NOT_USED_EXPIRY_SECONDS << "seconds - stopping connection."; << CONNECTION_NOT_USED_EXPIRY_SECONDS << "seconds - stopping connection.";
#endif #endif
emit connectionInactive(_destination); emit connectionInactive(_destination);
} }

View file

@ -343,10 +343,10 @@ void SendQueue::run() {
// If the flow window has been full for over CONSIDER_INACTIVE_AFTER, // If the flow window has been full for over CONSIDER_INACTIVE_AFTER,
// then signal the queue is inactive and return so it can be cleaned up // then signal the queue is inactive and return so it can be cleaned up
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "SendQueue to" << _destination << "reached" << NUM_TIMEOUTS_BEFORE_INACTIVE << "timeouts" qCDebug(networking) << "SendQueue to" << _destination << "reached" << NUM_TIMEOUTS_BEFORE_INACTIVE << "timeouts"
<< "and 10s before receiving any ACK/NAK and is now inactive. Stopping."; << "and 10s before receiving any ACK/NAK and is now inactive. Stopping.";
#endif #endif
deactivate(); deactivate();
@ -374,12 +374,12 @@ void SendQueue::run() {
doubleLock.unlock(); doubleLock.unlock();
if (cvStatus == std::cv_status::timeout) { if (cvStatus == std::cv_status::timeout) {
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "SendQueue to" << _destination << "has been empty for" qCDebug(networking) << "SendQueue to" << _destination << "has been empty for"
<< EMPTY_QUEUES_INACTIVE_TIMEOUT.count() << EMPTY_QUEUES_INACTIVE_TIMEOUT.count()
<< "seconds and receiver has ACKed all packets." << "seconds and receiver has ACKed all packets."
<< "The queue is now inactive and will be stopped."; << "The queue is now inactive and will be stopped.";
#endif #endif
deactivate(); deactivate();

View file

@ -186,9 +186,9 @@ Connection& Socket::findOrCreateConnection(const HifiSockAddr& sockAddr) {
QObject::connect(connection.get(), &Connection::connectionInactive, this, &Socket::cleanupConnection, QObject::connect(connection.get(), &Connection::connectionInactive, this, &Socket::cleanupConnection,
Qt::QueuedConnection); Qt::QueuedConnection);
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Creating new connection to" << sockAddr; qCDebug(networking) << "Creating new connection to" << sockAddr;
#endif #endif
it = _connectionsHash.insert(it, std::make_pair(sockAddr, std::move(connection))); it = _connectionsHash.insert(it, std::make_pair(sockAddr, std::move(connection)));
} }
@ -208,9 +208,9 @@ void Socket::clearConnections() {
} }
void Socket::cleanupConnection(HifiSockAddr sockAddr) { void Socket::cleanupConnection(HifiSockAddr sockAddr) {
#ifdef UDT_CONNECTION_DEBUG #ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Socket::cleanupConnection called for UDT connection to" << sockAddr; qCDebug(networking) << "Socket::cleanupConnection called for UDT connection to" << sockAddr;
#endif #endif
_connectionsHash.erase(sockAddr); _connectionsHash.erase(sockAddr);
} }

View file

@ -25,7 +25,7 @@
#include "CongestionControl.h" #include "CongestionControl.h"
#include "Connection.h" #include "Connection.h"
#define UDT_CONNECTION_DEBUG //#define UDT_CONNECTION_DEBUG
class UDTTest; class UDTTest;