X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=8f5758161d8d3425610793819f1f216234c1e741;hb=47a6910aed00018c7230cc2cc90ae8e80fa77dda;hp=5ef25571e7e1b24a8bd947a45a903d9547a8b28f;hpb=3972e140226f32760bb2606650f93132c188b2dc;p=quassel.git diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 5ef25571..8f575816 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -40,6 +40,7 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _lastPingTime(0), _pingCount(0), + _sendPings(false), _requestedUserModes('-') { _autoReconnectTimer.setSingleShot(true); @@ -446,6 +447,8 @@ void CoreNetwork::socketInitialized() emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); + enablePingTimeout(); + // TokenBucket to avoid sending too much at once _messageDelay = 2200; // this seems to be a safe value (2.2 seconds delay) _burstSize = 5; @@ -551,7 +554,7 @@ void CoreNetwork::networkInitialized() sendPerform(); - enablePingTimeout(); + _sendPings = true; if (networkConfig()->autoWhoEnabled()) { _autoWhoCycleTimer.start(); @@ -795,7 +798,9 @@ void CoreNetwork::sendPing() else { _lastPingTime = now; _pingCount++; - userInputHandler()->handlePing(BufferInfo(), QString()); + // Don't send pings until the network is initialized + if(_sendPings) + userInputHandler()->handlePing(BufferInfo(), QString()); } } @@ -815,6 +820,7 @@ void CoreNetwork::enablePingTimeout(bool enable) void CoreNetwork::disablePingTimeout() { _pingTimer.stop(); + _sendPings = false; resetPingTimeout(); }