mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
Add write watermarks to filtered bufferevents.
This commit is contained in:
parent
59d0f750c9
commit
f186e16241
@ -1,4 +1,9 @@
|
|||||||
o Major bugfixes (bufferevents):
|
o Major bugfixes (bufferevents):
|
||||||
- Apply rate-limiting only at the bottom of a chain of filtering
|
- Apply rate-limiting only at the bottom of a chain of filtering
|
||||||
bufferevents. This prevents us from filling up internal memory
|
bufferevents. This prevents us from filling up internal read
|
||||||
buffers. Bugfix on 0.2.3.1-alpha; fixes bug 3804.
|
buffers and violating rate-limits when filtering bufferevents
|
||||||
|
are enabled. Bugfix on 0.2.3.1-alpha; fixes part of bug 3804.
|
||||||
|
- Add high-watermarks to the output buffers for filtered
|
||||||
|
bufferevents. This prevents us from filling up internal write
|
||||||
|
buffers and wasting CPU cycles when filtering bufferevents are
|
||||||
|
enabled. Bugfix on 0.2.3.1-alpha; fixes part of bug 3804.
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#ifdef USE_BUFFEREVENTS
|
#ifdef USE_BUFFEREVENTS
|
||||||
#include <event2/bufferevent_ssl.h>
|
#include <event2/bufferevent_ssl.h>
|
||||||
#include <event2/buffer.h>
|
#include <event2/buffer.h>
|
||||||
|
#include <event2/event.h>
|
||||||
#include "compat_libevent.h"
|
#include "compat_libevent.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1905,6 +1906,10 @@ tor_tls_init_bufferevent(tor_tls_t *tls, struct bufferevent *bufev_in,
|
|||||||
state,
|
state,
|
||||||
BEV_OPT_DEFER_CALLBACKS|
|
BEV_OPT_DEFER_CALLBACKS|
|
||||||
BEV_OPT_CLOSE_ON_FREE);
|
BEV_OPT_CLOSE_ON_FREE);
|
||||||
|
/* Tell the underlying bufferevent when to accept more data from the SSL
|
||||||
|
filter (only when it's got less than 32K to write), and when to notify
|
||||||
|
the SSL filter that it could write more (when it drops under 24K). */
|
||||||
|
bufferevent_setwatermark(bufev_in, EV_WRITE, 24*1024, 32*1024);
|
||||||
} else {
|
} else {
|
||||||
if (bufev_in) {
|
if (bufev_in) {
|
||||||
evutil_socket_t s = bufferevent_getfd(bufev_in);
|
evutil_socket_t s = bufferevent_getfd(bufev_in);
|
||||||
|
Loading…
Reference in New Issue
Block a user