Fix reconnection logic in the client
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 27 Feb 2014 20:10:40 +0000 (21:10 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 27 Feb 2014 20:17:08 +0000 (21:17 +0100)
commite7657c44a3720231d89998f74f6369243431f878
treefc64f75b4753fd8808529352dd45b864be5f093b
parente53fc69a91553b57932ba599b39999d550114588
Fix reconnection logic in the client

Seems like b654b2f broke reconnecting the client to the core; it would
only try once and then stop trying. Thanks to mamarley for noticing that bug
and bisecting the culprit.

The main issue causing this was that CoreConnection called
resetConnection(false) before (re)connecting, thus clearing the reconnect
flag. This call is a remnant from before we refactored out all the socket
handling and should not be needed anymore, now that we have clean disconnected()
semantics. Before b654b2f this was not a problem, because we would always
receive a socket error on failed reconnect that would reinstate the flag.

Because b654b2f worked around another issue by always sending a disconnected()
when the socket goes back into UnconnectedState, and this would happen before
the socket error signal was sent, the error handling would never be called
and the reconnect flag thus not reinstated, causing this bug.

So the second fix is to spin the event loop such that the error signal can
overtake that disconnected() signal and be handled properly (so we also
get the socket error message in the status bar).
src/client/clientauthhandler.cpp
src/client/coreconnection.cpp