You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in function
int
bufferevent_replacefd(struct bufferevent *bev, evutil_socket_t fd)
line 896
only check
if (old_fd != EVUTIL_INVALID_SOCKET)
but not check
fd is eq old_fd
The text was updated successfully, but these errors were encountered:
mllw
changed the title
bufferevent_replacefd close socket when bufferevent‘s socket fd is eq release fd
bufferevent_replacefd close socket when bufferevent‘s socket fd is eq new fd
Mar 18, 2024
The check for old_fd is done to check should be call close or not, for new fd we do not need this.
Are you experiencing some issues with this behavior?
I first exported evhttp_get_request as a public function for logical processing.
After accepting a socket, use bufferevent to read the handshake information, then determine the protocol type, if it is http protocol, it is processed by evhttp_get_request.
This is done by passing the bufferevent and socket fd into evhttp_get_request, however, in the processing of evhttp_get_request, the bufferevent_replacefd function will be called, and at this time, the fd of the bufferevent and the fd of the socket are equal,. bufferevent_replacefd does not determine whether the new fd and old fd are equal, but instead closes the old fd directly, causing the socket to be closed.
I first exported evhttp_get_request as a public function for logical processing.
This is not an official API
Thought it had been requested multiple times - #1471
Are you interested?
I'm OK with exporting it if it will have some example that will show that it make sense in the official repo
in function
int
bufferevent_replacefd(struct bufferevent *bev, evutil_socket_t fd)
line 896
only check
if (old_fd != EVUTIL_INVALID_SOCKET)
but not check
fd is eq old_fd
The text was updated successfully, but these errors were encountered: