From 2e9855c688c827b2159fbb548bf816de360e3ae3 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Sat, 15 Feb 2014 21:49:59 +0100 Subject: [PATCH] Output the chosen protocol type on connect Just some debug messages showing which protocol has been selected. --- src/client/clientauthhandler.cpp | 2 ++ src/common/protocols/datastream/datastreampeer.h | 1 + src/common/protocols/legacy/legacypeer.h | 1 + src/common/remotepeer.h | 1 + src/core/coreauthhandler.cpp | 2 ++ 5 files changed, 7 insertions(+) diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 60407981..15efef36 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -251,6 +251,8 @@ void ClientAuthHandler::onProtocolVersionMismatch(int actual, int expected) void ClientAuthHandler::setPeer(RemotePeer *peer) { + qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "..."; + _peer = peer; connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int))); diff --git a/src/common/protocols/datastream/datastreampeer.h b/src/common/protocols/datastream/datastreampeer.h index 6f8a66c5..c733fda2 100644 --- a/src/common/protocols/datastream/datastreampeer.h +++ b/src/common/protocols/datastream/datastreampeer.h @@ -44,6 +44,7 @@ public: DataStreamPeer(AuthHandler *authHandler, QTcpSocket *socket, quint16 features, QObject *parent = 0); Protocol::Type protocol() const { return Protocol::DataStreamProtocol; } + QString protocolName() const { return "the DataStream protocol"; } static quint16 supportedFeatures(); static bool acceptsFeatures(quint16 peerFeatures); diff --git a/src/common/protocols/legacy/legacypeer.h b/src/common/protocols/legacy/legacypeer.h index 5aeafcae..a4c7a490 100644 --- a/src/common/protocols/legacy/legacypeer.h +++ b/src/common/protocols/legacy/legacypeer.h @@ -44,6 +44,7 @@ public: LegacyPeer(AuthHandler *authHandler, QTcpSocket *socket, QObject *parent = 0); Protocol::Type protocol() const { return Protocol::LegacyProtocol; } + QString protocolName() const { return "the legacy protocol"; } void setSignalProxy(SignalProxy *proxy); diff --git a/src/common/remotepeer.h b/src/common/remotepeer.h index 191439ef..e58d140b 100644 --- a/src/common/remotepeer.h +++ b/src/common/remotepeer.h @@ -46,6 +46,7 @@ public: void setSignalProxy(SignalProxy *proxy); virtual Protocol::Type protocol() const = 0; + virtual QString protocolName() const = 0; virtual QString description() const; virtual quint16 enabledFeatures() const { return 0; } diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index 7ca6d580..36eecc19 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -114,6 +114,8 @@ void CoreAuthHandler::onReadyRead() void CoreAuthHandler::setPeer(RemotePeer *peer) { + qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "..."; + _peer = peer; disconnect(socket(), SIGNAL(readyRead()), this, SLOT(onReadyRead())); } -- 2.20.1