[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:45 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=1ba6815
The following commit has been merged in the master branch:
commit 1ba68150a7edf59f3ab3b73a824b66c18b03d488
Author: Vineet Garg <grg.vineet at gmail.com>
Date: Fri Jul 10 03:57:27 2015 +0530
Made server like normal QTcpServer
---
CMakeLists.txt | 2 +-
core/backends/lan/lanlinkprovider.cpp | 21 +++++++++++++--------
core/backends/lan/lanlinkprovider.h | 2 +-
core/backends/lan/server.cpp | 16 +++++++++++++++-
core/backends/lan/server.h | 8 +++++---
5 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3071ab..df7dd50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,6 @@ add_subdirectory(plasmoid)
add_subdirectory(cli)
add_subdirectory(fileitemactionplugin)
-# add_subdirectory(tests)
+add_subdirectory(tests)
install(PROGRAMS kdeconnect-non-plasma.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp
index 0314ebf..c553754 100644
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@ -49,7 +49,7 @@ LanLinkProvider::LanLinkProvider()
connect(mUdpServer, SIGNAL(readyRead()), this, SLOT(newUdpConnection()));
mServer = new Server(this);
- connect(mServer,SIGNAL(newConnection(QSslSocket*)),this, SLOT(newConnection(QSslSocket*)));
+ connect(mServer,SIGNAL(newConnection()),this, SLOT(newConnection()));
pairingHandler = new LanPairingHandler();
@@ -302,17 +302,22 @@ void LanLinkProvider::sslErrors(QList<QSslError> errors)
//I'm the new device and this is the answer to my UDP identity package (no data received yet)
-void LanLinkProvider::newConnection(QSslSocket* socket)
+void LanLinkProvider::newConnection()
{
qDebug() << "LanLinkProvider newConnection " ;
- configureSocket(socket);
- //This socket is still managed by us (and child of the QTcpServer), if
- //it disconnects before we manage to pass it to a LanDeviceLink, it's
- //our responsibility to delete it. We do so with this connection.
+ while (mServer->hasPendingConnections()) {
+ QSslSocket* socket = mServer->nextPendingConnection();
+ configureSocket(socket);
+ //This socket is still managed by us (and child of the QTcpServer), if
+ //it disconnects before we manage to pass it to a LanDeviceLink, it's
+ //our responsability to delete it. We do so with this connection.
+ connect(socket, SIGNAL(disconnected()),
+ socket, SLOT(deleteLater()));
+ connect(socket, SIGNAL(readyRead()),
+ this, SLOT(dataReceived()));
- connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater()));
- connect(socket, SIGNAL(readyRead()), this, SLOT(dataReceived()));
+ }
}
//I'm the new device and this is the answer to my UDP identity package (data received)
diff --git a/core/backends/lan/lanlinkprovider.h b/core/backends/lan/lanlinkprovider.h
index d5dce06..9905543 100644
--- a/core/backends/lan/lanlinkprovider.h
+++ b/core/backends/lan/lanlinkprovider.h
@@ -55,7 +55,7 @@ public Q_SLOTS:
private Q_SLOTS:
void newUdpConnection();
- void newConnection(QSslSocket*);
+ void newConnection();
void dataReceived();
void deviceLinkDestroyed(QObject* destroyedDeviceLink);
void sslErrors(QList<QSslError> errors);
diff --git a/core/backends/lan/server.cpp b/core/backends/lan/server.cpp
index ea59193..a055d7c 100644
--- a/core/backends/lan/server.cpp
+++ b/core/backends/lan/server.cpp
@@ -36,9 +36,23 @@ Server::Server(QObject * parent)
void Server::incomingConnection(qintptr socketDescriptor) {
QSslSocket *serverSocket = new QSslSocket;
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
- Q_EMIT newConnection(serverSocket);
+ pendingConnections.push_back(serverSocket);
+ Q_EMIT newConnection();
} else {
delete serverSocket;
}
}
+QSslSocket* Server::nextPendingConnection() {
+ if (pendingConnections.size() == 0) {
+ return Q_NULLPTR;
+ } else {
+ QSslSocket *socket = pendingConnections.first();
+ pendingConnections.removeFirst();
+ return socket;
+ }
+}
+
+bool Server::hasPendingConnections() const {
+ return pendingConnections.size() != 0;
+}
diff --git a/core/backends/lan/server.h b/core/backends/lan/server.h
index b5c89d8..ff08d13 100644
--- a/core/backends/lan/server.h
+++ b/core/backends/lan/server.h
@@ -30,16 +30,18 @@ class Server
{
Q_OBJECT
+private:
+ QList<QSslSocket*> pendingConnections;
public:
Server(QObject* parent = 0);
virtual ~Server() {}
+ QSslSocket* nextPendingConnection() Q_DECL_OVERRIDE;
+ bool hasPendingConnections() const Q_DECL_OVERRIDE;
+
protected:
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- void newConnection(QSslSocket*);
};
#endif //KDECONNECT_SERVER_H
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list