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:
Azat Khuzhin 2018-11-05 22:25:15 +03:00 committed by Azat Khuzhin
parent 35ca964393
commit 98d0f92330
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

View File

@ -816,15 +816,15 @@ 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;
}
TT_BLATHER(("wm_transfer-%s(%p): "
"in: " EV_SIZE_FMT ", "