diff options
author | Loïc Hoguin <[email protected]> | 2019-10-01 21:13:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-10-01 21:13:31 +0200 |
commit | 0a1fb6cc317f7fd15214d53c5f03b8e29506f413 (patch) | |
tree | b1d6782cebbc23acac5f1d896800c07ea607fe37 /src | |
parent | 7d70e77d9f8dbddb14e41c5797787e00c9f613ea (diff) | |
download | cowlib-0a1fb6cc317f7fd15214d53c5f03b8e29506f413.tar.gz cowlib-0a1fb6cc317f7fd15214d53c5f03b8e29506f413.tar.bz2 cowlib-0a1fb6cc317f7fd15214d53c5f03b8e29506f413.zip |
Add cow_http2_machine:get_connection_local_buffer_size/1
The function can be used to restrict how big all the
buffers of a single connection can get.
Diffstat (limited to 'src')
-rw-r--r-- | src/cow_http2_machine.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cow_http2_machine.erl b/src/cow_http2_machine.erl index de2346d..5c9e66e 100644 --- a/src/cow_http2_machine.erl +++ b/src/cow_http2_machine.erl @@ -29,6 +29,7 @@ -export([update_window/2]). -export([update_window/3]). -export([reset_stream/2]). +-export([get_connection_local_buffer_size/1]). -export([get_local_setting/2]). -export([get_last_streamid/1]). -export([get_stream_local_buffer_size/2]). @@ -1408,6 +1409,14 @@ reset_stream(StreamID, State=#http2_machine{streams=Streams0}) -> {error, not_found} end. +%% Retrieve the buffer size for all streams. + +-spec get_connection_local_buffer_size(http2_machine()) -> non_neg_integer(). +get_connection_local_buffer_size(#http2_machine{streams=Streams}) -> + lists:foldl(fun(#stream{local_buffer_size=Size}, Acc) -> + Acc + Size + end, 0, Streams). + %% Retrieve a setting value, or its default value if not set. -spec get_local_setting(atom(), http2_machine()) -> atom() | integer(). |