30 m_webSocketsLock(QMutex::Recursive)
41 QMutexLocker locker(&m_webSocketsLock);
42 if (!m_webSockets.isEmpty())
43 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Closing outstanding websockets"));
44 while (!m_webSockets.isEmpty())
55 QThread *thread =
static_cast<QThread*
>(sender());
57 QMutexLocker locker(&m_webSocketsLock);
59 for (
int i = 0; i < m_webSockets.size(); ++i)
61 if (m_webSockets.value(i) == thread)
68 LOG(VB_NETWORK, LOG_INFO, QStringLiteral(
"WebSocket thread deleted"));
76 QMutexLocker locker(&m_webSocketsLock);
80 m_webSockets.append(thread);
87 QTcpSocket *socket =
new QTcpSocket();
88 socket->setSocketDescriptor(SocketDescriptor);
91 LOG(VB_GENERAL, LOG_WARNING, QStringLiteral(
"Ignoring incoming connection - too many connections"));
100 QMutexLocker locker(&m_webSocketsLock);
101 for (
int i = 0; i < m_webSockets.size(); ++i)
103 if (m_webSockets.value(i) == Socket)
104 return m_webSockets.takeAt(i);
void IncomingConnection(qintptr SocketDescriptor, bool Secure)
void WebSocketClosed(void)
#define MAX_SOCKET_THREADS
#define LOG(_MASK_, _LEVEL_, _STRING_)
Wraps a TorcQThread around a TorcWebsocket.
TorcWebSocketThread * TakeSocket(TorcWebSocketThread *Socket)