memcached.c
void do_accept_new_conns(const bool do_accept) {
    conn *next;

    for (next = listen_conn; next; next = next->next) {
        if (do_accept) {
            update_event(next, EV_READ | EV_PERSIST);
            if (listen(next->sfd, settings.backlog) != 0) {
                perror("listen");
            }
        }
        else {
            update_event(next, 0);
            if (listen(next->sfd, 0) != 0) {
                perror("listen");
            }
        }
    }

    if (do_accept) {
        STATS_LOCK();
        stats.accepting_conns = true;
        STATS_UNLOCK();
    } else {
        STATS_LOCK();
        stats.accepting_conns = false;
        stats.listen_disabled_num++;
        STATS_UNLOCK();
        allow_new_conns = false;
        maxconns_handler(-42, 0, 0);
    }
}
/*
 * Sets whether we are listening for new connections or not.
 */
Sets whether we are listening for new connections or not.
Sets whether we are listening for new connections or not .
void do_accept_new_conns(const bool do_accept) {
    conn *next;
    for (next = listen_conn; next; next = next->next) {
        if (do_accept) {
            update_event(next, EV_READ | EV_PERSIST);
            if (listen(next->sfd, settings.backlog) != 0) {
                perror("listen");
            }
        }
        else {
            update_event(next, 0);
            if (listen(next->sfd, 0) != 0) {
                perror("listen");
            }
        }
    }
    if (do_accept) {
        STATS_LOCK();
        stats.accepting_conns = true;
        STATS_UNLOCK();
    } else {
        STATS_LOCK();
        stats.accepting_conns = false;
        stats.listen_disabled_num++;
        STATS_UNLOCK();
        allow_new_conns = false;
        maxconns_handler(-42, 0, 0);
    }
}
void do_accept_new_conns ( const bool do_accept ) { conn * next ; for ( next = listen_conn ; next ; next = next -> next ) { if ( do_accept ) { update_event ( next , EV_READ | EV_PERSIST ) ; if ( listen ( next -> sfd , settings . backlog ) != 0 ) { perror ( " " ) ; } } else { update_event ( next , 0 ) ; if ( listen ( next -> sfd , 0 ) != 0 ) { perror ( " " ) ; } } } if ( do_accept ) { STATS_LOCK ( ) ; stats . accepting_conns = true ; STATS_UNLOCK ( ) ; } else { STATS_LOCK ( ) ; stats . accepting_conns = false ; stats . listen_disabled_num ++ ; STATS_UNLOCK ( ) ; allow_new_conns = false ; maxconns_handler ( -42 , 0 , 0 ) ; } }
Sets whether we are listening for new connections or not.
Sets whether we are listening for new connections or not .