コード例 #1
0
void TApplicationServer::incomingConnection(int socketDescriptor)
{
    T_TRACEFUNC("socketDescriptor: %d", socketDescriptor);
 
    switch ( Tf::app()->multiProcessingModule() ) {
    case TWebApplication::Thread:
        for (;;) {
            if (actionContextCount() < maxServers) {
                TActionThread *thread = new TActionThread(socketDescriptor);
                connect(thread, SIGNAL(finished()), this, SLOT(deleteActionContext()));
                insertPointer(thread);
                thread->start();
                break;
            }
            Tf::msleep(1);
            qApp->processEvents(QEventLoop::ExcludeSocketNotifiers);
        }
        break;

    case TWebApplication::Prefork: {
        close();  // Closes the listening port
        TActionForkProcess *process = new TActionForkProcess(socketDescriptor);
        connect(process, SIGNAL(finished()), this, SLOT(deleteActionContext()));
        insertPointer(process);
        process->start();
        break; }

    default:
        break;
    }
}
コード例 #2
0
void TWorkerStarter::startWorker(int fd, const QByteArray &request, const QString &address)
{
    //
    // Create worker threads in main thread for signal/slot mechanism!
    //
    TActionWorker *worker = new TActionWorker(fd, THttpRequest(request, QHostAddress(address)));
    connect(worker, SIGNAL(finished()), multiplexingServer, SLOT(deleteActionContext()));
    multiplexingServer->insertPointer(worker);
    worker->start();
}
コード例 #3
0
{
    close();
    releaseAllContexts();
}


void TPreforkApplicationServer::incomingConnection(
#if QT_VERSION >= 0x050000
    qintptr socketDescriptor)
#else
    int socketDescriptor)
#endif
{
    T_TRACEFUNC("socketDescriptor: %d", socketDescriptor);

    close();  // Closes the listening port
    TActionForkProcess *process = new TActionForkProcess(socketDescriptor);
    connect(process, SIGNAL(finished()), this, SLOT(deleteActionContext()));
    insertPointer(process);
    process->start();
}


void TPreforkApplicationServer::deleteActionContext()
{
    T_TRACEFUNC("");
    deletePointer(reinterpret_cast<TActionForkProcess *>(sender()));
    sender()->deleteLater();
}