From e73875dfe2f2644c80823b06ebedb2c8fec1a845 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 11 Nov 2018 21:51:46 +0300 Subject: [PATCH] bev_async: set "ok" on setfd if fd>=0 (like we do during creation) Otherwise after .setfd, .enable will not work. --- bufferevent_async.c | 2 ++ 1 file changed, 2 insertions(+) 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: { -- 2.40.0