Permalink
Browse files

Fixing the buffer resizing

  • Loading branch information...
ferd committed Nov 6, 2013
1 parent 2e97016 commit ad80bc3eb9061ce5324e30af575c8419e2ddb676
Showing with 5 additions and 2 deletions.
  1. +3 −0 src/logplex_msg_buffer.erl
  2. +2 −2 src/logplex_tcpsyslog_drain.erl
@@ -28,6 +28,7 @@
,push/2
,push_ext/2
,len/1
+ ,max_size/1
,empty/1
,pop/1
,resize/2
@@ -92,6 +93,8 @@ empty(#lpdb{}) -> not_empty.
len(#lpdb{size=Len}) -> Len.
+max_size(#lpdb{max_size=Max}) -> Max.
+
-spec to_list(buf()) -> [msg()].
to_list(#lpdb{messages = Q,
loss_count = 0}) ->
@@ -561,13 +561,13 @@ target_send_size() ->
end.
maybe_resize(Buf) ->
- case logplex_msg_buffer:len(Buf) =:= ?SHRINK_BUF_SIZE of
+ case logplex_msg_buffer:max_size(Buf) =:= ?SHRINK_BUF_SIZE of
true -> logplex_msg_buffer:resize(default_buf_size(), Buf);
false -> Buf
end.
maybe_shrink(Buf, LastGood) ->
- case logplex_msg_buffer:len(Buf) =:= ?SHRINK_BUF_SIZE of
+ case logplex_msg_buffer:max_size(Buf) =:= ?SHRINK_BUF_SIZE of
true ->
Buf;
false ->

0 comments on commit ad80bc3

Please sign in to comment.