X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=d3c4645b1b41ea8bdcbe98b9e66973008e617eec;hp=575d20cdebe15fd71e18b50b09cabc0abb550cef;hb=dcc541413235e39cc505061950d4aafa89367f98;hpb=425364f5f68a37582ddfa0494f4305f98f761e23 diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 575d20cd..d3c4645b 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -44,9 +44,6 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _previousConnectionAttemptFailed(false), _lastUsedServerIndex(0), - _lastPingTime(0), - _pingCount(0), - _sendPings(false), _requestedUserModes('-') { _autoReconnectTimer.setSingleShot(true); @@ -253,6 +250,9 @@ void CoreNetwork::connectToIrc(bool reconnecting) enablePingTimeout(); + // Reset tracking for valid timestamps in PONG replies + setPongTimestampValid(false); + // Qt caches DNS entries for a minute, resulting in round-robin (e.g. for chat.freenode.net) not working if several users // connect at a similar time. QHostInfo::fromName(), however, always performs a fresh lookup, overwriting the cache entry. if (! server.useProxy) { @@ -940,8 +940,12 @@ void CoreNetwork::sendPing() _lastPingTime = now; _pingCount++; // Don't send pings until the network is initialized - if(_sendPings) + if(_sendPings) { + // Mark as waiting for a reply + _pongReplyPending = true; + // Send default timestamp ping userInputHandler()->handlePing(BufferInfo(), QString()); + } } } @@ -952,6 +956,7 @@ void CoreNetwork::enablePingTimeout(bool enable) disablePingTimeout(); else { resetPingTimeout(); + resetPongReplyPending(); if (networkConfig()->pingTimeoutEnabled()) _pingTimer.start(); } @@ -963,6 +968,7 @@ void CoreNetwork::disablePingTimeout() _pingTimer.stop(); _sendPings = false; resetPingTimeout(); + resetPongReplyPending(); } @@ -972,6 +978,12 @@ void CoreNetwork::setPingInterval(int interval) } +void CoreNetwork::setPongTimestampValid(bool validTimestamp) +{ + _pongTimestampValid = validTimestamp; +} + + /******** Custom Rate Limiting ********/ void CoreNetwork::updateRateLimiting(const bool forceUnlimited)