Keep _wantReconnect set to true by default instead of false 133/head
authorMichael Marley <michael@michaelmarley.com>
Sat, 13 Jun 2015 21:38:29 +0000 (17:38 -0400)
committerMichael Marley <michael@michaelmarley.com>
Sat, 13 Jun 2015 21:57:49 +0000 (17:57 -0400)
Previously _wantReconnect was set to false by default (unless the
client was actually disconnected).  If the disconnect() signal was
fired without any other signals (socketError(), for example), this
would cause the client to not reconnect.  This seems to be
happening rather often with Qt5 client builds because a vast
majority of the time when I restart my core (or the entire core
server), the Qt5 clients do not reconnect.  This patch keeps
_wantReconnect set to true whenever the client is connected so that
problem will not occur anymore.  Disconnecting manually will set
it back to false so that the client won't try to reconnect after
a manual disconnect.

src/client/coreconnection.cpp

index 0e4b4f9..9f876f9 100644 (file)
@@ -216,6 +216,8 @@ void CoreConnection::setState(ConnectionState state)
     if (state != _state) {
         _state = state;
         emit stateChanged(state);
+        if (state == Connected)
+            _wantReconnect = true;
         if (state == Disconnected)
             emit disconnected();
     }