mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-03 17:26:24 -04:00
regress_ssl: make ssl/bufferevent_wm_filter more fault-tolerance
Due to inplace callbacks (i.e. no BEV_OPT_DEFER_CALLBACKS) we cannot be sure that wm_transfer() will not be called recursively and indeed it still happens sometimes, and the referenced patch increase amount of this times, especially for linux/poll. Fixes: 66304a23cf748714159c988e78f35401c5352827 ("Fix ssl/bufferevent_wm_filter when bev does not reach watermark on break") (cherry picked from commit 54c6fe3c06cb5342130467ecf0f78e3f6d854a36)
This commit is contained in:
parent
35ca964393
commit
98d0f92330
@ -816,16 +816,16 @@ wm_transfer(struct bufferevent *bev, void *arg)
|
||||
size_t len = evbuffer_get_length(in);
|
||||
size_t drain = len < ctx->to_read ? len : ctx->to_read;
|
||||
|
||||
if (ctx->get+drain >= ctx->limit) {
|
||||
if (ctx->get >= ctx->limit) {
|
||||
TT_BLATHER(("wm_transfer-%s(%p): break",
|
||||
ctx->server ? "server" : "client", bev));
|
||||
bufferevent_setcb(bev, NULL, NULL, NULL, NULL);
|
||||
bufferevent_disable(bev, EV_READ);
|
||||
} else {
|
||||
evbuffer_drain(in, drain);
|
||||
ctx->get += drain;
|
||||
}
|
||||
|
||||
evbuffer_drain(in, drain);
|
||||
ctx->get += drain;
|
||||
|
||||
TT_BLATHER(("wm_transfer-%s(%p): "
|
||||
"in: " EV_SIZE_FMT ", "
|
||||
"out: " EV_SIZE_FMT ", "
|
||||
|
Loading…
x
Reference in New Issue
Block a user