anchor.diff:                              ok, Message),
                   %% may fail, when tcp just closed
                   _ = inet:setopts(Socket, [{active, once}]),
  -                inc_r_msg_count(State);
  +                state_after_receiving(State, lists:nth(1, Message));
               {?deliver, Process, Message} ->
                   ?TRACE("Received message ~.0p", [Message]),
                   ?LOG_MESSAGE_SOCK('rcv', Data, byte_size(Data), channel(State)),
                   forward_msg(Process, Message, State),
                   %% may fail, when tcp just closed
                   _ = inet:setopts(Socket, [{active, once}]),
  -                inc_r_msg_count(State);
  +                state_after_receiving(State, Message);
               {user_close} ->
                   log:log(warn,"[ CC ~p (~p) ] tcp user_close request", [self(), pid_groups:my_pidname()]),
                   close_connection(Socket, State);
  
positive.code: -spec set_last_stat_report(state(), stat_report()) -> state().
  set_last_stat_report(State, Val) -> setelement(13, State, Val).
  
  -spec last_msg_sent(state()) -> erlang:timestamp().
  last_msg_sent(State) -> element(14, State).
  -spec set_last_msg_sent(state()) -> state().
  set_last_msg_sent(State) -> setelement(14, State, os:timestamp()).
  
  -spec s_msg_count_session(state()) -> non_neg_integer().
  s_msg_count_session(State)             -> element(15, State).
  -spec inc_s_msg_count_session(state()) -> state().
  inc_s_msg_count_session(State)         -> setelement(15, State, s_msg_count_session(State) + 1).
  
  -spec r_msg_count_session(state()) -> non_neg_integer().
  r_msg_count_session(State)             -> element(16, State).
  -spec inc_r_msg_count_session(state()) -> state().
  inc_r_msg_count_session(State)         -> setelement(16, State, r_msg_count_session(State) + 1).
  
  -spec reset_msg_counters(state()) -> state().
  reset_msg_counters(State) -> State1 = setelement(15, State, 0),
  
negative.code:                       OQueue::[comm:send_options()]}.
  -type stat_report() :: {RcvCnt::non_neg_integer(), RcvBytes::non_neg_integer(),
                          SendCnt::non_neg_integer(), SendBytes::non_neg_integer()}.
  -type time_last_msg_sent() :: erlang:timestamp().
  
  -type state() ::
      {DestIP                  :: inet:ip_address(),
  