]> granicus.if.org Git - libevent/commitdiff
bev_async: set "ok" on setfd if fd>=0 (like we do during creation)
authorAzat Khuzhin <a3at.mail@gmail.com>
Sun, 11 Nov 2018 18:51:46 +0000 (21:51 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Tue, 13 Nov 2018 19:29:08 +0000 (22:29 +0300)
Otherwise after .setfd, .enable will not work.

bufferevent_async.c

index 3f06341fcb6b31aa89fe00baaa8a4c9f71a957b1..1cd9e5c37af85519f5783d209859650d1d0da6d4 100644 (file)
@@ -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: {