From fc2d1e24e276685429ff280468b779df2f78fab1 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 15 Aug 2021 14:41:54 +0100 Subject: [PATCH] Fix for left over CIV client on server --- udpserver.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/udpserver.cpp b/udpserver.cpp index 3aac1dd..6bc80a7 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -461,7 +461,6 @@ void udpServer::civReceived() if (current == Q_NULLPTR) { current = new CLIENT(); - foreach(CLIENT* client, controlClients) { if (client != Q_NULLPTR) @@ -474,6 +473,13 @@ void udpServer::civReceived() } } + if (current->controlClient == Q_NULLPTR || !current->controlClient->isAuthenticated) + { + // There is no current controlClient that matches this civClient + delete current; + return; + } + current->type = "CIV"; current->civId = 0; current->connected = true; @@ -504,10 +510,6 @@ void udpServer::civReceived() } - if (current->controlClient == Q_NULLPTR || !current->controlClient->isAuthenticated) - { - return; - } switch (r.length()) { @@ -621,6 +623,14 @@ void udpServer::audioReceived() } } } + + if (current->controlClient == Q_NULLPTR || !current->controlClient->isAuthenticated) + { + // There is no current controlClient that matches this audioClient + delete current; + return; + } + current->type = "Audio"; current->connected = true; current->timeConnected = QDateTime::currentDateTime(); @@ -1581,6 +1591,7 @@ void udpServer::deleteConnection(QList* l, CLIENT* c) while (it != l->end()) { CLIENT* client = *it; if (client != Q_NULLPTR && client == c) { + qInfo(logUdpServer()) << "Found" << client->type << "connection to: " << client->ipAddress.toString() << ":" << QString::number(client->port); it = l->erase(it); } else {