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); } }
static void pollWinTimer(MprCmd *cmd, MprEvent *event) { if (!cmd->complete) { pollWinCmd(cmd, 0); } if (cmd->complete) { mprStopContinuousEvent(event); } }
/* * Timer callback */ static void timerCallback(void *data, MprEvent *event) { mprLock(mutex); if (--markCount == 0) { mprSignalCond(complete); } mprStopContinuousEvent(event); mprUnlock(mutex); }
/* * 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); }