Skip to content

Commit

Permalink
RemoteTCPSink: Handle client disconnecting immediately.
Browse files Browse the repository at this point in the history
  • Loading branch information
srcejon committed Dec 24, 2024
1 parent c5efd73 commit d3584f6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ RemoteTCPProtocol::Device RemoteTCPSinkSink::getDevice()

void RemoteTCPSinkSink::acceptWebConnection()
{
QMutexLocker mutexLocker(&m_mutex);
QWebSocket *client = m_webSocketServer->nextPendingConnection();
QMutexLocker mutexLocker(&m_mutex);
QWebSocket *client = m_webSocketServer->nextPendingConnection();

connect(client, &QWebSocket::binaryMessageReceived, this, &RemoteTCPSinkSink::processCommand);
connect(client, &QWebSocket::disconnected, this, &RemoteTCPSinkSink::disconnected);
Expand All @@ -891,8 +891,11 @@ void RemoteTCPSinkSink::acceptWebConnection()
// https://bugreports.qt.io/browse/QTBUG-125874
QTimer::singleShot(200, this, [this, client] () {
QMutexLocker mutexLocker(&m_mutex);
m_clients.append(new WebSocket(client));
acceptConnection(m_clients.last());
if (client->isValid())
{
m_clients.append(new WebSocket(client));
acceptConnection(m_clients.last());
}
});
}

Expand All @@ -912,8 +915,11 @@ void RemoteTCPSinkSink::acceptTCPConnection()

QTimer::singleShot(200, this, [this, client] () {
QMutexLocker mutexLocker(&m_mutex);
m_clients.append(new TCPSocket(client));
acceptConnection(m_clients.last());
if (client->isValid())
{
m_clients.append(new TCPSocket(client));
acceptConnection(m_clients.last());
}
});
}

Expand Down

0 comments on commit d3584f6

Please sign in to comment.