serrno = EVUTIL_SOCKET_ERROR(); event_sock_warn(fd, "%s: listen", __func__); evutil_closesocket(fd); EVUTIL_SET_SOCKET_ERROR(serrno); return (NULL); } //accept 处理 bound = evhttp_accept_socket_with_handle(http, fd); if (bound != NULL) { event_debug(("Bound to port %d -...
/*Listener callback when a connection arrives at a server.*/staticvoidaccept_socket_cb(structevconnlistener *listener, evutil_socket_t nfd,structsockaddr *peer_sa,intpeer_socklen,void*arg) {structevhttp *http =arg; evhttp_get_request(http, nfd, peer_sa, peer_socklen); } staticvoidevhttp_g...
/*Listener callback when a connection arrives at a server.*/staticvoidaccept_socket_cb(structevconnlistener *listener, evutil_socket_t nfd,structsockaddr *peer_sa,intpeer_socklen,void*arg) {structevhttp *http =arg; evhttp_get_request(http, nfd, peer_sa, peer_socklen); } staticvoidevhttp_g...
}// Bind to port.intret = evhttp_bind_socket(eh_,NULL, port);if(ret <0) {evhttp_free(eh_); event_base_free(eb_);throwTException("evhttp_bind_socket failed"); }// Register a handler. If you use the other constructor,// you will want to do this yourself.// Don't forget to ...