anchor.diff:      %% Stale message.
       send(State);
   ready_to_send({timeout, _Ref, ?IDLE_TIMEOUT_MSG}, S) ->
  -    close_if_idle(S);
  +    close_if_idle(S, disconnected, ready_to_send);
   ready_to_send({post, Msg}, State = #state{sock = Sock})
     when is_port(Sock) ->
       send(buffer(Msg, State));
  
positive.code:             ?INFO("drain_id=~p channel_id=~p dest=~s at=idle_timeout",
                    log_info(State, [])),
              gen_tcp:close(Sock),
              {next_state, disconnecting, State#state{sock=undefined}, hibernate};
          _ ->
              {next_state, sending, start_idle_timer(State)}
      end.
  
  buffer_to_pkts(Buf, BytesRemaining, DrainTok) ->
  
negative.code:     NewTimer = erlang:start_timer(MaxIdle + Fuzz, self(), ?IDLE_TIMEOUT_MSG),
      State#state{idle_tref = NewTimer}.
  
  close_if_idle(State = #state{sock = Sock, last_good_time = LastGood},
                ClosedState, ContinueState) ->
      MaxIdle = logplex_app:config(tcp_syslog_idle_timeout, timer:minutes(5)),
      SinceLastGoodMicros = timer:now_diff(os:timestamp(), LastGood),
      case SinceLastGoodMicros > (MaxIdle * 1000) of
  