diff options
author | Thuan Tran <thuan.tran@edgeware.tv> | 2023-05-15 19:57:38 +0700 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2023-05-16 21:11:54 +0200 |
commit | 4ab3242da1b5ae5d99ff2086df935057880ca9ff (patch) | |
tree | eaabd9a5860329f1d639969364c45da1078ef0d4 | |
parent | acfac7ae4a3edbbb7ce4ceee7208b4245a6e203e (diff) | |
download | libevent-4ab3242da1b5ae5d99ff2086df935057880ca9ff.tar.gz |
Make bufferevent_set_max_single_read() effect
-rw-r--r-- | bufferevent_ssl.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/bufferevent_ssl.c b/bufferevent_ssl.c index 17046b82..58945e62 100644 --- a/bufferevent_ssl.c +++ b/bufferevent_ssl.c @@ -407,8 +407,6 @@ do_write(struct bufferevent_ssl *bev_ssl, int atmost) #define WRITE_FRAME 15000 -#define READ_DEFAULT 4096 - /* Try to figure out how many bytes to read; return 0 if we shouldn't be * reading. */ static int @@ -416,7 +414,7 @@ bytes_to_read(struct bufferevent_ssl *bev) { struct evbuffer *input = bev->bev.bev.input; struct event_watermark *wm = &bev->bev.bev.wm_read; - int result = READ_DEFAULT; + int result = 0; ev_ssize_t limit; /* XXX 99% of this is generic code that nearly all bufferevents will * want. */ @@ -439,13 +437,11 @@ bytes_to_read(struct bufferevent_ssl *bev) } result = wm->high - evbuffer_get_length(input); - } else { - result = READ_DEFAULT; } /* Respect the rate limit */ limit = bufferevent_get_read_max_(&bev->bev); - if (result > limit) { + if (result == 0 || result > limit) { result = limit; } |