anchor.diff:  on({web_debug_info, Requestor}, State) ->
       Now = os:timestamp(),
       TimeLastMsgSent = time_last_msg_sent(State),
  -    SecondsAgo =
  -        case TimeLastMsgSent of
  -            {0,0,0} -> infinity;
  -            _ ->  timer:now_diff(Now, TimeLastMsgSent) div 1000000
  -        end,
  +    TimeLastMsgReceived = time_last_msg_received(State),
  +    SecondsAgoSent = seconds_ago(Now, TimeLastMsgSent),
  +    SecondsAgoReceived = seconds_ago(Now, TimeLastMsgReceived),
       Runtime = timer:now_diff(Now, started(State)) / 1000000,
       {SentPerS, ReceivedPerS} =
           if Runtime =< 0 -> {"n/a", "n/a"};
  
positive.code: -define(TRACE(X,Y), ok).
  -behaviour(gen_component).
  
  -compile({inline, [dest_ip/1, dest_port/1, local_listen_port/1, channel/1,
                     socket/1, set_socket/2,
                     started/1,
  
negative.code: -spec set_time_last_msg_sent(state()) -> state().
  set_time_last_msg_sent(State) -> setelement(14, State, os:timestamp()).
  
  -spec time_last_msg_received(state()) -> erlang:timestamp().
  time_last_msg_received(State) -> element(15, State).
  -spec set_time_last_msg_received(state()) -> state().
  set_time_last_msg_received(State) -> setelement(15, State, os:timestamp()).
  
  -spec s_msg_count_session(state()) -> non_neg_integer().
  s_msg_count_session(State)         -> element(16, State).
  -spec inc_s_msg_count_session(state(), pos_integer()) -> state().
  inc_s_msg_count_session(State, N)  -> setelement(16, State, s_msg_count_session(State) + N).
  
  -spec r_msg_count_session(state()) -> non_neg_integer().
  r_msg_count_session(State)         -> element(17, State).
  -spec inc_r_msg_count_session(state(), pos_integer()) -> state().
  inc_r_msg_count_session(State, N)  -> setelement(17, State, r_msg_count_session(State) + N).
  
  -spec reset_msg_counters(state()) -> state().
  reset_msg_counters(State) -> State1 = setelement(16, State, 0),
                               State2 = setelement(17, State1, 0),
                               inc_session_count(State2).
  
  -spec session_count(state()) -> state().
  session_count(State) -> element(18, State).
  -spec inc_session_count(state()) -> state().
  inc_session_count(State) -> setelement(18, State, session_count(State) + 1).
  
  -spec last_msg_sent(state()) -> [comm:message()].
  last_msg_sent(State) -> element(19, State).
  -spec set_last_msg_sent(state(), [comm:message()]) -> state().
  set_last_msg_sent(State, Msg) ->
      OldList = last_msg_sent(State),
      NumToKeep = erlang:max(?NUM_KEEP_MSGS - length(Msg), 0),
      NewList = Msg ++ lists:sublist(OldList, NumToKeep),
      State2 = set_time_last_msg_sent(State),
      State3 = inc_s_msg_count(State2, length(Msg)),
      setelement(19, State3, NewList).
  
  -spec last_msg_received(state()) -> [comm:message()].
  last_msg_received(State) -> element(20, State).
  -spec set_last_msg_received(state(), [comm:message()]) -> state().
  set_last_msg_received(State, Msg) ->
      OldList = last_msg_received(State),
      NumToKeep = erlang:max(?NUM_KEEP_MSGS - length(Msg), 0),
      NewList = Msg ++ lists:sublist(OldList, NumToKeep),
      State2 = set_time_last_msg_received(State),
      State3 = inc_r_msg_count(State2, length(Msg)),
      setelement(20, State3, NewList).
  
  -spec save_n_msgs([msg_or_tag()], fun((state(), [msg_or_tag()]) -> state()), state()) -> state().
  save_n_msgs(Msg, SaveFun, State) when is_tuple(Msg) ->
      save_n_msgs([{single, Msg}], SaveFun, State);
  save_n_msgs(Msgs, SaveFun, State) when is_list(Msgs) ->
      NumElements = erlang:min(?NUM_KEEP_MSGS, length(Msgs)),
      List = [get_msg_tag(M) || M <- lists:sublist(Msgs, NumElements)],
      SaveFun(State, List).
  
  -spec get_msg_tag(msg_or_tag()) -> comm:msg_tag() | comm:message().
  get_msg_tag(Msg) ->
      {_Pid, ActualMessage} = Msg,
      ?IIF(?KEEP_MSG_OR_TAG =:= tag,
           util:extint2atom(comm:get_msg_tag(ActualMessage)),
           setelement(1, ActualMessage, util:extint2atom(element(1, ActualMessage)))).
  
  -spec seconds_ago(time_last_msg(), time_last_msg()) -> non_neg_integer().
  seconds_ago(Now, Time) ->
      case Time of
          {0,0,0} -> infinity;
          _ -> timer:now_diff(Now, Time) div 1000000
      end.
  
  -spec start_idle_check() -> ok.
  start_idle_check() ->
  