anchor.diff:                            {next_state, pstate(), #state{}}.
   do_reconnect(State = #state{sock = undefined,
                               reconnect_tref = undefined,
  +                            buf=Buf,
                               failures = Failures}) ->
       case connect(State) of
           {ok, Sock} ->
               ?INFO("drain_id=~p channel_id=~p dest=~s "
                     "state=disconnected at=connect try=~p sock=~p",
                     log_info(State, [Failures + 1, Sock])),
  +            NewBuf = case logplex_msg_buffer:len(Buf) =:= ?SHRINK_BUF_SIZE of
  +                        true -> logplex_msg_buffer:resize(?DEFAULT_BUF_SIZE, Buf);
  +                        false -> Buf
  +                    end,
               NewState = State#state{sock=Sock,
                                      reconnect_tref = undefined,
                                      send_tref = undefined,
  +                                   buf = NewBuf,
                                      connect_time=os:timestamp()},
               send(NewState);
           {error, Reason} ->
  
positive.code:                 port :: inet:port_number(),
                  sock = undefined :: 'undefined' | inet:socket(),
                  %% Buffer for messages while disconnected
                  buf = logplex_msg_buffer:new() :: logplex_msg_buffer:buf(),
                  %% Last time we connected or successfully sent data
                  last_good_time :: 'undefined' | erlang:timestamp(),
                  %% TCP failures since last_good_time
  
negative.code: -define(SEND_TIMEOUT_MSG, send_timeout).
  -define(SEND_TIMEOUT, timer:seconds(4)).
  -define(HIBERNATE_TIMEOUT, 5000).
  -define(SHRINK_TIMEOUT, timer:minutes(5)).
  -define(SHRINK_BUF_SIZE, 10).
  -define(DEFAULT_BUF_SIZE, 1024).
  
  -include("logplex.hrl").
  -include("logplex_logging.hrl").
  