Example #1
0
void ServerPool::newTcpConnection(qt_socket_fd_t socket)
{
    // Ignore connections from an SSL server for now, these are only handled
    // by HttpServer which overrides newTcpConnection
    PrivTcpServer *server = dynamic_cast<PrivTcpServer *>(QObject::sender());
    if (!server || server->GetServerType() == kSSLServer)
        return;

    QTcpSocket *qsock = new QTcpSocket(this);
    if (qsock->setSocketDescriptor(socket))
    {
        emit newConnection(qsock);
    }
    else
        delete qsock;
}
Example #2
0
void WebSocketServer::newTcpConnection(qt_socket_fd_t socket)
{

    PoolServerType type = kTCPServer;
    PrivTcpServer *server = dynamic_cast<PrivTcpServer *>(QObject::sender());
    if (server)
        type = server->GetServerType();

    m_threadPool.startReserved(
        new WebSocketWorkerThread(*this, socket, type
#ifndef QT_NO_OPENSSL
               , m_sslConfig
#endif
               ),
        QString("WebSocketServer%1").arg(socket));
}