_autoReconnectCount = 0; // prohibiting auto reconnect
}
disablePingTimeout();
+ _msgQueue.clear();
IrcUser *me_ = me();
if(me_) {
}
// TokenBucket to avoid sending too much at once
- _messagesPerSecond = 1;
+ _messageDelay = 2200; // this seems to be a safe value (2.2 seconds delay)
_burstSize = 5;
- _tokenBucket = 5; // init with a full bucket
- _tokenBucketTimer.start(_messagesPerSecond * 1000);
+ _tokenBucket = _burstSize; // init with a full bucket
+ _tokenBucketTimer.start(_messageDelay);
if(!server.password.isEmpty()) {
putRawLine(serverEncode(QString("PASS %1").arg(server.password)));
void CoreNetwork::socketDisconnected() {
disablePingTimeout();
+ _msgQueue.clear();
_autoWhoCycleTimer.stop();
_autoWhoTimer.stop();
void CoreNetwork::sendPing() {
uint now = QDateTime::currentDateTime().toTime_t();
+ if(_pingCount != 0) {
+ qDebug() << "UserId:" << userId() << "Network:" << networkName() << "missed" << _pingCount << "pings."
+ << "BA:" << socket.bytesAvailable() << "BTW:" << socket.bytesToWrite();
+ }
if(_pingCount >= _maxPingCount && now - _lastPingTime <= (uint)(_pingTimer.interval() / 1000) + 1) {
// the second check compares the actual elapsed time since the last ping and the pingTimer interval
// if the interval is shorter then the actual elapsed time it means that this thread was somehow blocked