static void new_connection(int server_fd, int is_rtsp)

{

    struct sockaddr_in from_addr;

    int fd, len;

    HTTPContext *c = NULL;



    len = sizeof(from_addr);

    fd = accept(server_fd, (struct sockaddr *)&from_addr, 

                &len);

    if (fd < 0)

        return;

    fcntl(fd, F_SETFL, O_NONBLOCK);



    /* XXX: should output a warning page when coming

       close to the connection limit */

    if (nb_connections >= nb_max_connections)

        goto fail;

    

    /* add a new connection */

    c = av_mallocz(sizeof(HTTPContext));

    if (!c)

        goto fail;

    

    c->next = first_http_ctx;

    first_http_ctx = c;

    c->fd = fd;

    c->poll_entry = NULL;

    c->from_addr = from_addr;

    c->buffer_size = IOBUFFER_INIT_SIZE;

    c->buffer = av_malloc(c->buffer_size);

    if (!c->buffer)

        goto fail;

    nb_connections++;

    

    start_wait_request(c, is_rtsp);



    return;



 fail:

    if (c) {

        av_free(c->buffer);

        av_free(c);

    }

    close(fd);

}

static void new_connection(int server_fd, int is_rtsp)

{

    struct sockaddr_in from_addr;

    int fd, len;

    HTTPContext *c = NULL;



    len = sizeof(from_addr);

    fd = accept(server_fd, (struct sockaddr *)&from_addr, 

                &len);

    if (fd < 0)

        return;

    fcntl(fd, F_SETFL, O_NONBLOCK);



    



    if (nb_connections >= nb_max_connections)

        goto fail;

    

    

    c = av_mallocz(sizeof(HTTPContext));

    if (!c)

        goto fail;

    

    c->next = first_http_ctx;

    first_http_ctx = c;

    c->fd = fd;

    c->poll_entry = NULL;

    c->from_addr = from_addr;

    c->buffer_size = IOBUFFER_INIT_SIZE;

    c->buffer = av_malloc(c->buffer_size);

    if (!c->buffer)

        goto fail;

    nb_connections++;

    

    start_wait_request(c, is_rtsp);



    return;



 fail:

    if (c) {

        av_free(c->buffer);

        av_free(c);

    }

    close(fd);

}

    c->next = first_http_ctx;     first_http_ctx = c;
static void FUNC_0(int VAR_0, int VAR_1)

{

    struct sockaddr_in VAR_2;

    int VAR_3, VAR_4;

    HTTPContext *c = NULL;



    VAR_4 = sizeof(VAR_2);

    VAR_3 = accept(VAR_0, (struct sockaddr *)&VAR_2, 

                &VAR_4);

    if (VAR_3 < 0)

        return;

    fcntl(VAR_3, F_SETFL, O_NONBLOCK);



    



    if (nb_connections >= nb_max_connections)

        goto fail;

    

    

    c = av_mallocz(sizeof(HTTPContext));

    if (!c)

        goto fail;

    

    c->next = first_http_ctx;

    first_http_ctx = c;

    c->VAR_3 = VAR_3;

    c->poll_entry = NULL;

    c->VAR_2 = VAR_2;

    c->buffer_size = IOBUFFER_INIT_SIZE;

    c->buffer = av_malloc(c->buffer_size);

    if (!c->buffer)

        goto fail;

    nb_connections++;

    

    start_wait_request(c, VAR_1);



    return;



 fail:

    if (c) {

        av_free(c->buffer);

        av_free(c);

    }

    close(VAR_3);

}

static void FUNC_0(int VAR_0, int VAR_1)
{ struct sockaddr_in VAR_2; int VAR_3, VAR_4; HTTPContext *c = NULL; VAR_4 = sizeof(VAR_2); VAR_3 = accept(VAR_0, (struct sockaddr *)&VAR_2,
&VAR_4); if (VAR_3 < 0)
return; fcntl(VAR_3, F_SETFL, O_NONBLOCK); if (nb_connections >= nb_max_connections)
goto fail; c = av_mallocz(sizeof(HTTPContext)); if (!c)
goto fail; c->next = first_http_ctx; first_http_ctx = c; c->VAR_3 = VAR_3; c->poll_entry = NULL; c->VAR_2 = VAR_2; c->buffer_size = IOBUFFER_INIT_SIZE; c->buffer = av_malloc(c->buffer_size); if (!c->buffer)
goto fail; nb_connections++; start_wait_request(c, VAR_1); return; fail:
if (c) { av_free(c->buffer); av_free(c); } close(VAR_3); }