예제 #1
0
static void waitForCgi(Cgi *cgi, MprEvent *event)
{
    HttpConn    *conn;
    MprCmd      *cmd;

    conn = cgi->conn;
    cmd = cgi->cmd;
    if (cmd && !cmd->complete) {
        if (conn->error && cmd->pid) {
            mprStopCmd(cmd, -1);
            mprStopContinuousEvent(event);
        }
    } else {
        mprStopContinuousEvent(event);
    }
}
예제 #2
0
파일: cmd.c 프로젝트: embedthis/mpr
static void pollWinTimer(MprCmd *cmd, MprEvent *event)
{
    if (!cmd->complete) {
        pollWinCmd(cmd, 0);
    }
    if (cmd->complete) {
        mprStopContinuousEvent(event);
    }
}
예제 #3
0
파일: benchMpr.c 프로젝트: embedthis/mpr-3
/*
 *  Timer callback 
 */
static void timerCallback(void *data, MprEvent *event)
{
    mprLock(mutex);
    if (--markCount == 0) {
        mprSignalCond(complete);
    }
    mprStopContinuousEvent(event);
    mprUnlock(mutex);
}
예제 #4
0
파일: host.c 프로젝트: jsjohnst/appweb
/*
 *  The host timer does maintenance activities and will fire per second while there is active requests.
 *  When multi-threaded, the host timer runs as an event off the service thread. Because we lock the host here,
 *  connections cannot be deleted while we are modifying the list.
 */
static void hostTimer(MaHost *host, MprEvent *event)
{
    MaConn      *conn;
    int         next, connCount;

    lock(host);

    updateCurrentDate(host);

    /*
     *  Check for any expired connections
     */
    for (connCount = 0, next = 0; (conn = mprGetNextItem(host->connections, &next)) != 0; connCount++) {
        /*
         *  Workaround for a GCC bug when comparing two 64bit numerics directly. Need a temporary.
         */
        int64 diff = conn->expire - host->whenCurrentDate;
        if (diff < 0) {
            //  thread will have the connection lock and may be trying to get the host lock.
            // mprFree(conn);
            // mprCloseSocket(
            // if (conn->sock && conn->sock->handler) {
            //     mprRecallWaitHandler(conn->sock->handler);
            // }
            // closesocket(conn->sock->fd);
            conn->keepAliveCount = 0;
            mprSetSocketEventMask(conn->sock, MPR_WRITEABLE);
        }
    }

    if (event) {
        if (connCount == 0) {
            mprStopContinuousEvent(event);
        }
        mprFree(event);
    }
    unlock(host);
}