From: Azat Khuzhin Date: Sun, 11 Nov 2018 18:51:46 +0000 (+0300) Subject: bev_async: set "ok" on setfd if fd>=0 (like we do during creation) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e73875dfe2f2644c80823b06ebedb2c8fec1a845;p=libevent bev_async: set "ok" on setfd if fd>=0 (like we do during creation) Otherwise after .setfd, .enable will not work. --- diff --git a/bufferevent_async.c b/bufferevent_async.c index 3f06341f..1cd9e5c3 100644 --- a/bufferevent_async.c +++ b/bufferevent_async.c @@ -663,6 +663,7 @@ be_async_ctrl(struct bufferevent *bev, enum bufferevent_ctrl_op op, data->fd = evbuffer_overlapped_get_fd_(bev->input); return 0; case BEV_CTRL_SET_FD: { + struct bufferevent_async *bev_a = upcast(bev); struct event_iocp_port *iocp; if (data->fd == evbuffer_overlapped_get_fd_(bev->input)) @@ -675,6 +676,7 @@ be_async_ctrl(struct bufferevent *bev, enum bufferevent_ctrl_op op, } evbuffer_overlapped_set_fd_(bev->input, data->fd); evbuffer_overlapped_set_fd_(bev->output, data->fd); + bev_a->ok = data->fd >= 0; return 0; } case BEV_CTRL_CANCEL_ALL: {