]> granicus.if.org Git - libevent/commitdiff
be_sock: unfreeze buffers on fd changing
authorAzat Khuzhin <a3at.mail@gmail.com>
Fri, 11 Mar 2016 10:55:41 +0000 (13:55 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Fri, 11 Mar 2016 15:53:10 +0000 (18:53 +0300)
Only bufferevent_sock have evbuffer_freeze()/evbuffer_unfreeze() & ctrl ops, so
we don't need to fix other bufferevents (be_pair doesn't have ctrl op).

Found during draining buffers in http layer, and hence 501-not-implemented
error in regress http/.. (with some custom hacking).

bufferevent_sock.c

index a2b381ac4df67f5ee5d8d567b995523cfca00764..5ffd2ab39ee245b5e373f62039e52575043f49a0 100644 (file)
@@ -630,6 +630,9 @@ be_socket_setfd(struct bufferevent *bufev, evutil_socket_t fd)
        event_del(&bufev->ev_read);
        event_del(&bufev->ev_write);
 
+       evbuffer_unfreeze(bufev->input, 0);
+       evbuffer_unfreeze(bufev->output, 1);
+
        event_assign(&bufev->ev_read, bufev->ev_base, fd,
            EV_READ|EV_PERSIST|EV_FINALIZE, bufferevent_readcb, bufev);
        event_assign(&bufev->ev_write, bufev->ev_base, fd,