common: Don't warn when "closing" InternalPeer
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 27 Sep 2018 22:56:35 +0000 (00:56 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2018 17:06:49 +0000 (19:06 +0200)
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
src/common/internalpeer.h

index 30b4669..6ce19bd 100644 (file)
@@ -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;
     }
 
index f40f8eb..a94802d 100644 (file)
@@ -93,7 +93,7 @@ private:
 
 private:
     SignalProxy *_proxy{nullptr};
-    bool _isOpen{false};
+    bool _isOpen{true};
 };
 
 Q_DECLARE_METATYPE(QPointer<InternalPeer>)