summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
575f27e)
If the network connection status changed during authentication phase,
Quassel would crash. This is caused by some old bits of code that still
assume that there's always a Peer around, which is no longer the case
after splitting off the AuthHandler.
This commit fixes that issue. Thanks to shadeslayer for the report and
really useful backtrace.
return false;
if (currentAccount().isInternal())
return true;
return false;
if (currentAccount().isInternal())
return true;
- if (_peer->isLocal())
- return true;
+ if (_authHandler)
+ return _authHandler->isLocal();
+ if (_peer)
+ return _peer->isLocal();
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include <QHostAddress>
+
#include "authhandler.h"
AuthHandler::AuthHandler(QObject *parent)
#include "authhandler.h"
AuthHandler::AuthHandler(QObject *parent)
+bool AuthHandler::isLocal() const
+{
+ if (socket()) {
+ if (socket()->peerAddress() == QHostAddress::LocalHost || socket()->peerAddress() == QHostAddress::LocalHostIPv6)
+ return true;
+ }
+ return false;
+}
+
+
// Some errors (e.g. connection refused) don't trigger a disconnected() from the socket, so send this explicitly
// (but make sure it's only sent once!)
void AuthHandler::onSocketError(QAbstractSocket::SocketError error)
// Some errors (e.g. connection refused) don't trigger a disconnected() from the socket, so send this explicitly
// (but make sure it's only sent once!)
void AuthHandler::onSocketError(QAbstractSocket::SocketError error)
QTcpSocket *socket() const;
QTcpSocket *socket() const;
+ bool isLocal() const;
+
virtual void handle(const Protocol::RegisterClient &) { invalidMessage(); }
virtual void handle(const Protocol::ClientDenied &) { invalidMessage(); }
virtual void handle(const Protocol::ClientRegistered &) { invalidMessage(); }
virtual void handle(const Protocol::RegisterClient &) { invalidMessage(); }
virtual void handle(const Protocol::ClientDenied &) { invalidMessage(); }
virtual void handle(const Protocol::ClientRegistered &) { invalidMessage(); }