From 17fb652189fe89b446e672505cc8b0138f79e8b8 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Fri, 28 Sep 2018 00:56:35 +0200 Subject: [PATCH] common: Don't warn when "closing" InternalPeer InternalPeer may be closed legitimately like any other peer type. Although for InternalPeer this just sets a flag, it should not produce a warning claiming that the method is not implemented. Also actually report the open status for InternalPeer. Ensure that it is constructed in open state, otherwise a signalproxy cannot be set. --- src/common/internalpeer.cpp | 8 ++++---- src/common/internalpeer.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/internalpeer.cpp b/src/common/internalpeer.cpp index 30b46698..6ce19bd2 100644 --- a/src/common/internalpeer.cpp +++ b/src/common/internalpeer.cpp @@ -67,7 +67,7 @@ quint16 InternalPeer::port() const bool InternalPeer::isOpen() const { - return true; + return _isOpen; } @@ -85,9 +85,8 @@ bool InternalPeer::isLocal() const void InternalPeer::close(const QString &reason) { - // FIXME - Q_UNUSED(reason) - qWarning() << "closing not implemented!"; + Q_UNUSED(reason); + _isOpen = false; } @@ -116,6 +115,7 @@ void InternalPeer::setSignalProxy(::SignalProxy *proxy) if (proxy && !_proxy) { _proxy = proxy; + _isOpen = true; return; } diff --git a/src/common/internalpeer.h b/src/common/internalpeer.h index f40f8eb9..a94802d2 100644 --- a/src/common/internalpeer.h +++ b/src/common/internalpeer.h @@ -93,7 +93,7 @@ private: private: SignalProxy *_proxy{nullptr}; - bool _isOpen{false}; + bool _isOpen{true}; }; Q_DECLARE_METATYPE(QPointer) -- 2.20.1