mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Adjust evbuffer max read for bufferevents
This commit is contained in:
parent
8c2001e92a
commit
5357c3d62a
@ -855,14 +855,16 @@ int
|
||||
bufferevent_set_max_single_read(struct bufferevent *bev, size_t size)
|
||||
{
|
||||
struct bufferevent_private *bevp;
|
||||
int ret = 0;
|
||||
BEV_LOCK(bev);
|
||||
bevp = BEV_UPCAST(bev);
|
||||
if (size == 0 || size > EV_SSIZE_MAX)
|
||||
bevp->max_single_read = MAX_SINGLE_READ_DEFAULT;
|
||||
else
|
||||
bevp->max_single_read = size;
|
||||
ret = evbuffer_set_max_read(bev->input, bevp->max_single_read);
|
||||
BEV_UNLOCK(bev);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1085,5 +1087,8 @@ bufferevent_ratelim_init_(struct bufferevent_private *bev)
|
||||
bev->max_single_read = MAX_SINGLE_READ_DEFAULT;
|
||||
bev->max_single_write = MAX_SINGLE_WRITE_DEFAULT;
|
||||
|
||||
if (evbuffer_set_max_read(bev->bev.input, bev->max_single_read))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -890,6 +890,8 @@ int bufferevent_remove_from_rate_limit_group(struct bufferevent *bev);
|
||||
Set to 0 for a reasonable default.
|
||||
|
||||
Return 0 on success and -1 on failure.
|
||||
|
||||
@see evbuffer_set_max_read()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_set_max_single_read(struct bufferevent *bev, size_t size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user