X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=3fd0a1a70431242c5f8c5b998ad657642ef87c53;hb=815c628e93f34d546eed234adabe58a76d83e7fd;hp=e0d4fa6eb90a771854e7cf4612230323d4ae21db;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index e0d4fa6e..3fd0a1a7 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -44,7 +44,6 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _requestedUserModes('-') { _autoReconnectTimer.setSingleShot(true); - _socketCloseTimer.setSingleShot(true); connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout())); setPingInterval(networkConfig()->pingInterval()); @@ -183,6 +182,8 @@ void CoreNetwork::connectToIrc(bool reconnecting) socket.setProxy(QNetworkProxy::NoProxy); } + enablePingTimeout(); + #ifdef HAVE_SSL socket.setProtocol((QSsl::SslProtocol)server.sslVersion); if (server.useSsl) { @@ -437,7 +438,9 @@ void CoreNetwork::socketInitialized() if (server.useSsl && !socket.isEncrypted()) return; #endif - +#if QT_VERSION >= 0x040600 + socket.setSocketOption(QAbstractSocket::KeepAliveOption, true); +#endif CoreIdentity *identity = identityPtr(); if (!identity) { qCritical() << "Identity invalid!"; @@ -447,8 +450,6 @@ 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;