PUBLIC HttpQueue *httpCreateQueueHead(HttpConn *conn, cchar *name) { HttpQueue *q; if ((q = mprAllocObj(HttpQueue, manageQueue)) == 0) { return 0; } httpInitQueue(conn, q, name); httpInitSchedulerQueue(q); return q; }
static void commonPrep(HttpConn *conn) { if (conn->timeoutEvent) { mprRemoveEvent(conn->timeoutEvent); conn->timeoutEvent = 0; } conn->lastActivity = conn->http->now; conn->error = 0; conn->errorMsg = 0; conn->state = 0; conn->authRequested = 0; httpSetState(conn, HTTP_STATE_BEGIN); httpInitSchedulerQueue(conn->serviceq); }
/* Create a queue associated with a connection. Prev may be set to the previous queue in a pipeline. If so, then the Conn.readq and writeq are updated. */ PUBLIC HttpQueue *httpCreateQueue(HttpConn *conn, HttpStage *stage, int dir, HttpQueue *prev) { HttpQueue *q; if ((q = mprAllocObj(HttpQueue, manageQueue)) == 0) { return 0; } q->conn = conn; httpInitQueue(conn, q, sfmt("%s-%s", stage->name, dir == HTTP_QUEUE_TX ? "tx" : "rx")); httpInitSchedulerQueue(q); httpAssignQueue(q, stage, dir); if (prev) { httpAppendQueue(prev, q); if (dir == HTTP_QUEUE_RX) { conn->readq = conn->tx->queue[HTTP_QUEUE_RX]->prevQ; } else { conn->writeq = conn->tx->queue[HTTP_QUEUE_TX]->nextQ; } } return q; }