set SO_KEEPALIVE on client sockets
[quassel.git] / src / client / clientauthhandler.cpp
index a390ab6..8fc2a73 100644 (file)
@@ -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  *
@@ -144,6 +144,8 @@ void ClientAuthHandler::onSocketConnected()
         return;
     }
 
+    socket()->setSocketOption(QAbstractSocket::KeepAliveOption, true);
+
     _peer = new LegacyPeer(this, socket(), this);
 
     connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int)));
@@ -166,14 +168,14 @@ void ClientAuthHandler::onProtocolVersionMismatch(int actual, int expected)
 {
     emit errorPopup(tr("<b>The Quassel Core you are trying to connect to is too old!</b><br>"
            "We need at least protocol v%1, but the core speaks v%2 only.").arg(expected, actual));
-    requestDisconnect();
+    requestDisconnect(tr("Incompatible protocol version, connection to core refused"));
 }
 
 
 void ClientAuthHandler::handle(const ClientDenied &msg)
 {
     emit errorPopup(msg.errorString);
-    requestDisconnect();
+    requestDisconnect(tr("The core refused connection from this client"));
 }