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.
This commit is contained in:
Àlex Fiestas 2014-04-14 21:47:31 +02:00
parent e4e4004912
commit 4a74f413ae

View file

@ -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);