c - Limit connections in libevent -
i want control limit of possible libevent-http connections per process.
how can ?
i didn't found info in documentation, please help!
i think if didn't limit number of connections - system can crash. project high load.
ev_base = event_init(); ev_http = evhttp_new(ev_base); // limit http connections here... how can that?
struct evconnlistener * evconnlistener_new(struct event_base *base, evconnlistener_cb cb, void *ptr, unsigned flags, int backlog, evutil_socket_t fd)
the backlog want modify. internally call:
listen(fd, backlog)
however in http library fix backlog 128:
evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port) { [...] if (listen(fd, 128) == -1) { event_sock_warn(fd, "%s: listen", __func__); evutil_closesocket(fd); return (null); } [...] }
Comments
Post a Comment