X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=3fd0a1a70431242c5f8c5b998ad657642ef87c53;hb=2e9855c688c827b2159fbb548bf816de360e3ae3;hp=8f5758161d8d3425610793819f1f216234c1e741;hpb=9b8923e3625b5634163b5c164df8fa6a3760f660;p=quassel.git diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 8f575816..3fd0a1a7 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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;