anchor.diff:                              ok, Message),
                   %% may fail, when tcp just closed
                   _ = inet:setopts(Socket, [{active, once}]),
  -                state_after_receiving(State, lists:nth(1, Message));
  +                save_n_msgs(Message, fun set_last_msg_received/2, State);
               {?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}]),
  -                state_after_receiving(State, Message);
  +                save_n_msgs(Message, fun set_last_msg_received/2, State);
               {user_close} ->
                   log:log(warn,"[ CC ~p (~p) ] tcp user_close request", [self(), pid_groups:my_pidname()]),
                   close_connection(Socket, State);
  
positive.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(),
  
negative.code:      DesiredBundleSize       :: non_neg_integer(),
       MsgsSinceBundleStart    :: non_neg_integer(),
       LastStatReport          :: stat_report(),
       TimeLastMsgSent         :: time_last_msg(),
       TimeLastMsgReceived     :: time_last_msg(),
       SentMsgCountSession     :: non_neg_integer(),
       ReceivedMsgCountSession :: non_neg_integer(),
       SessionCount            :: non_neg_integer(),
       LastMsgSent             :: [msg_or_tag()],
       LastMsgReceived         :: [msg_or_tag()]
      }.
  -type message() ::
      {send, DestPid::pid(), Message::comm:message(), Options::comm:send_options()} |
  