anchor.diff:  -define(SHRINK_TRIES, 10).
   -define(SHRINK_BUF_SIZE, 10).
   -define(IDLE_TIMEOUT_MSG, idle_timeout).
  --define(IDLE_TIMEOUT, logplex_app:config(tcpsyslog_drain_idle_timeout,
  -                                         timer:minutes(5)))
   
   -include("logplex.hrl").
   -include("logplex_logging.hrl").
  
positive.code:     send(State);
  ready_to_send({timeout, _Ref, ?IDLE_TIMEOUT_MSG},
                State = #state{sock = Sock}) ->
      gen_tcp:close(Sock),
      {next_state, disconnected, State#state{sock = undefined,
                                             idle_tref = undefined}, hibernate};
  
negative.code:          "err=gen_tcp data=~p sock=~p duration=~s state=sending",
            log_info(S, [sending, Reason, Sock, duration(S)])),
      reconnect(tcp_bad(S));
  sending({timeout, _, ?IDLE_TIMEOUT_MSG}, State = #state{idle_tref = TRef}) ->
      cancel_timeout(TRef, ?IDLE_TIMEOUT_MSG),
      {next_state, disconnecting, State#state{idle_tref=undefined}};
  sending(timeout, S = #state{}) ->
      %% Sleep when inactive, trigger fullsweep GC & Compact
      {next_state, sending, S, hibernate};
  