Пример #1
0
/*  
    function accept(): Request
 */
static EjsRequest *hs_accept(Ejs *ejs, EjsHttpServer *sp, int argc, EjsObj **argv)
{
    HttpConn    *conn;
    MprEvent    event;

    memset(&event, 0, sizeof(MprEvent));
    event.dispatcher = sp->endpoint->dispatcher;
    if ((conn = httpAcceptConn(sp->endpoint, &event)) == 0) {
        /* Just ignore */
        mprError("Cannot accept connection");
        return 0;
    }
    return createRequest(sp, conn);
}
Пример #2
0
/*
    function accept(): Request
 */
static EjsRequest *hs_accept(Ejs *ejs, EjsHttpServer *sp, int argc, EjsObj **argv)
{
    MprSocket   *sock;
    HttpConn    *conn;
    MprEvent    event;

    if ((sock = mprAcceptSocket(sp->endpoint->sock)) == 0) {
        /* Just ignore */
        return 0;
    }
    memset(&event, 0, sizeof(MprEvent));
    event.dispatcher = sp->endpoint->dispatcher;
    event.sock = sock;
    if ((conn = httpAcceptConn(sp->endpoint, &event)) == 0) {
        /* Just ignore */
        mprLog("ejs web", 0, "Cannot accept connection");
        return 0;
    }
    return createRequest(sp, conn);
}