anchor.diff:      logplex_stats:incr(#drain_stat{drain_id=DrainId,
                                      channel_id=ChannelId,
                                      key=Key}, N).
  +
  +duration(#state{connect_time=undefined}) ->
  +    undefined;
  +duration(#state{connect_time=T0}) ->
  +    US = timer:now_diff(os:timestamp(), T0),
  +    US / 1000000.
  
positive.code:     {noreply, State};
  
  handle_info({tcp_closed, S}, State = #state{sock = S}) ->
      ?INFO("drain_id=~p channel_id=~p dest=~s at=close sock=~p",
            log_info(State, [S])),
      {noreply, reconnect(tcp_closed, State#state{sock=undefined})};
  
  handle_info({tcp_closed, S}, State = #state{}) ->
  
negative.code:         {ok, Sock} ->
              ?INFO("drain_id=~p channel_id=~p dest=~s at=connect try=~p sock=~p",
                    log_info(State, [State#state.failures + 1, Sock])),
              NewState = tcp_good(State#state{sock=Sock,
                                              connect_time=os:timestamp()}),
              {noreply, post_buffer(NewState)};
          {error, Reason} ->
              NewState = tcp_bad(State),
  