From 4a74f413ae209594fc754de44c6cc64491854bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Mon, 14 Apr 2014 21:47:31 +0200 Subject: [PATCH] Accept all connections until none are available When newConnection is called pendingConnections may have more than one connectio, so we have to iterate and use all of them. --- kded/backends/lan/lanlinkprovider.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kded/backends/lan/lanlinkprovider.cpp b/kded/backends/lan/lanlinkprovider.cpp index cd4f2d5e0..36c3bc46b 100644 --- a/kded/backends/lan/lanlinkprovider.cpp +++ b/kded/backends/lan/lanlinkprovider.cpp @@ -222,10 +222,12 @@ void LanLinkProvider::newConnection() { //kDebug(kdeconnect_kded()) << "LanLinkProvider newConnection"; - QTcpSocket* socket = mTcpServer->nextPendingConnection(); - socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + while(mTcpServer->hasPendingConnections()) { + QTcpSocket* socket = mTcpServer->nextPendingConnection(); + socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); - connect(socket,SIGNAL(readyRead()),this,SLOT(dataReceived())); + connect(socket, SIGNAL(readyRead()), this, SLOT(dataReceived())); + } /* NetworkPackage np(PACKAGE_TYPE_IDENTITY);