[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:29:00 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=26b0ec8

The following commit has been merged in the master branch:
commit 26b0ec8b98d05b521ec63840a5ea56a2c5c3f4f0
Author: Aleix Pol <aleixpol at kde.org>
Date:   Wed Sep 9 12:30:39 2015 +0200

    Make sure we don't disconnect from discovering remotes
    
    Otherwise it's hard to let other devices connect to us, without having both
    devices in discoverability mode.
    
    Reviewed by Albert Vaca
---
 core/backends/devicelink.cpp                  | 3 ++-
 core/backends/devicelink.h                    | 9 ++++++++-
 core/backends/lan/landevicelink.cpp           | 4 ++--
 core/backends/lan/landevicelink.h             | 2 +-
 core/backends/lan/lanlinkprovider.cpp         | 6 +++---
 core/backends/loopback/loopbackdevicelink.cpp | 2 +-
 core/daemon.cpp                               | 6 ++++--
 7 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/core/backends/devicelink.cpp b/core/backends/devicelink.cpp
index 08a3f83..bb190fd 100644
--- a/core/backends/devicelink.cpp
+++ b/core/backends/devicelink.cpp
@@ -22,10 +22,11 @@
 #include "kdeconnectconfig.h"
 #include "linkprovider.h"
 
-DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent)
+DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent, ConnectionStarted connectionSource)
     : QObject(parent)
     , mPrivateKey(KdeConnectConfig::instance()->privateKey())
     , mDeviceId(deviceId)
+    , mConnectionSource(connectionSource)
     , mLinkProvider(parent)
 {
     Q_ASSERT(!deviceId.isEmpty());
diff --git a/core/backends/devicelink.h b/core/backends/devicelink.h
index af17662..158db8d 100644
--- a/core/backends/devicelink.h
+++ b/core/backends/devicelink.h
@@ -35,7 +35,9 @@ class DeviceLink
     Q_OBJECT
 
 public:
-    DeviceLink(const QString& deviceId, LinkProvider* parent);
+    enum ConnectionStarted : bool { Locally, Remotely };
+
+    DeviceLink(const QString& deviceId, LinkProvider* parent, ConnectionStarted connectionSource);
     virtual ~DeviceLink() { };
 
     const QString& deviceId() { return mDeviceId; }
@@ -44,6 +46,10 @@ public:
     virtual bool sendPackage(NetworkPackage& np) = 0;
     virtual bool sendPackageEncrypted(QCA::PublicKey& publicKey, NetworkPackage& np) = 0;
 
+    ConnectionStarted connectionSource() const {
+        return mConnectionSource;
+    }
+
 Q_SIGNALS:
     void receivedPackage(const NetworkPackage& np);
 
@@ -52,6 +58,7 @@ protected:
 
 private:
     const QString mDeviceId;
+    const ConnectionStarted mConnectionSource;
     LinkProvider* mLinkProvider;
 
 };
diff --git a/core/backends/lan/landevicelink.cpp b/core/backends/lan/landevicelink.cpp
index 2290382..10273fe 100644
--- a/core/backends/lan/landevicelink.cpp
+++ b/core/backends/lan/landevicelink.cpp
@@ -31,8 +31,8 @@
 #include "downloadjob.h"
 #include "socketlinereader.h"
 
-LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QTcpSocket* socket)
-    : DeviceLink(deviceId, parent)
+LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QTcpSocket* socket, ConnectionStarted connectionSource)
+    : DeviceLink(deviceId, parent, connectionSource)
     , mSocketLineReader(new SocketLineReader(socket))
 {
     connect(mSocketLineReader, SIGNAL(readyRead()),
diff --git a/core/backends/lan/landevicelink.h b/core/backends/lan/landevicelink.h
index b16daa2..35a83eb 100644
--- a/core/backends/lan/landevicelink.h
+++ b/core/backends/lan/landevicelink.h
@@ -35,7 +35,7 @@ class LanDeviceLink
     Q_OBJECT
 
 public:
-    LanDeviceLink(const QString& deviceId, LinkProvider* parent, QTcpSocket* socket);
+    LanDeviceLink(const QString& deviceId, LinkProvider* parent, QTcpSocket* socket, ConnectionStarted connectionSource);
 
     bool sendPackage(NetworkPackage& np) override;
     bool sendPackageEncrypted(QCA::PublicKey& key, NetworkPackage& np) override;
diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp
index 85a1904..8aee748 100644
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@ -106,7 +106,7 @@ void LanLinkProvider::onNetworkChange()
 
 //I'm the existing device, a new device is kindly introducing itself.
 //I will create a TcpSocket and try to connect. This can result in either connected() or connectError().
-void LanLinkProvider::newUdpConnection()
+void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
 {
     while (mUdpServer->hasPendingDatagrams()) {
         QByteArray datagram;
@@ -174,8 +174,8 @@ void LanLinkProvider::connected()
     NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
     const QString& deviceId = receivedPackage->get<QString>("deviceId");
     //qCDebug(KDECONNECT_CORE) << "Connected" << socket->isWritable();
+    LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket, DeviceLink::Remotely);
 
-    LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
 
     NetworkPackage np2("");
     NetworkPackage::createIdentityPackage(&np2);
@@ -262,7 +262,7 @@ void LanLinkProvider::dataReceived()
                socket, SLOT(deleteLater()));
 
     const QString& deviceId = np.get<QString>("deviceId");
-    LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
+    LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket, DeviceLink::Locally);
     connect(deviceLink, SIGNAL(destroyed(QObject*)),
             this, SLOT(deviceLinkDestroyed(QObject*)));
 
diff --git a/core/backends/loopback/loopbackdevicelink.cpp b/core/backends/loopback/loopbackdevicelink.cpp
index ac174d4..f975330 100644
--- a/core/backends/loopback/loopbackdevicelink.cpp
+++ b/core/backends/loopback/loopbackdevicelink.cpp
@@ -23,7 +23,7 @@
 #include "loopbacklinkprovider.h"
 
 LoopbackDeviceLink::LoopbackDeviceLink(const QString& deviceId, LoopbackLinkProvider* provider)
-    : DeviceLink(deviceId, provider)
+    : DeviceLink(deviceId, provider, Remotely)
 {
 
 }
diff --git a/core/daemon.cpp b/core/daemon.cpp
index ec97166..99cff72 100644
--- a/core/daemon.cpp
+++ b/core/daemon.cpp
@@ -163,8 +163,10 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
         Device* device = new Device(this, identityPackage, dl);
         //qCDebug(KDECONNECT_CORE) << "It is a new device";
 
-        if (d->discoveryMode && !device->isPaired()) {
-            device->deleteLater();
+        //we discard the connections that we created but it's not paired.
+        //we keep the remotely initiated ones, since the remotes require them
+        if (!isDiscoveringDevices() && !device->isPaired() && dl->connectionSource() == DeviceLink::ConnectionStarted::Locally) {
+            dl->deleteLater();
         } else {
             connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceStatusChanged()));
             connect(device, SIGNAL(pairingChanged(bool)), this, SLOT(onDeviceStatusChanged()));

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list