libevent2 fix: unfreeze the client evbuffer

libevent2 has this concept of "freezeness" of a buffer.  It's a way to
avoid accidentally write/remove data from the wrong "edge" of the
buffer.  The client_tls_{read,write} functions need to add/drain data
from the opposite edge, hence the need for the unfreeze call.

This is the minimum change in order to work on libevent2 too.  Another
way would be to define evbuffer_{un,}freeze as NOP on libevent 1, but
it's ugly IMHO.
This commit is contained in:
Omar Polo 2021-10-02 17:20:56 +00:00
parent efb6210d77
commit acafce5b7d
1 changed files with 5 additions and 0 deletions

View File

@ -505,6 +505,11 @@ found:
event_set(&c->bev->ev_write, c->fd, EV_WRITE,
client_tls_writecb, c->bev);
#if HAVE_LIBEVENT2
evbuffer_unfreeze(c->bev->input, 0);
evbuffer_unfreeze(c->bev->output, 1);
#endif
bufferevent_enable(c->bev, EV_READ);
return;