anchor.diff:  -spec resend_all_messages(Msgs :: messages(), SessId :: session:id()) ->
       {NewSeqNum :: sequence_number(), NewMsgs :: messages()}.
   resend_all_messages(Msgs, SessId) ->
  -    {ok, Con} = session_connections:get_random_connection(SessId),
  -    resend_all_messages(Msgs, Con, 0, queue:new()).
  +    resend_all_messages(Msgs, SessId, 0, queue:new()).
   
   %%--------------------------------------------------------------------
   %% @private
  
positive.code:     stream_id = StmId, sequence_number = SeqNum, session_id = SessId} = State) ->
      case LowerSeqNum < SeqNum of
          true ->
              {ok, Con} = session_connections:get_random_connection(SessId),
              ok = resend_messages(LowerSeqNum, UpperSeqNum, Msgs, StmId, Con),
              State;
          false ->
              State
  
negative.code: %% Resends stored messages in inclusive range [LowerSeqNum, UpperSeqNum].
  %% @end
  %%--------------------------------------------------------------------
  -spec resend_messages(LowerSeqNum :: sequence_number(), UpperSeqNum ::
      sequence_number(), Msgs :: messages(), StmId :: stream_id(),
      SessId :: session:id()) -> ok | {error, Reason :: term()}.
  resend_messages(LowerSeqNum, UpperSeqNum, _, _, _) when LowerSeqNum > UpperSeqNum ->
      ok;
  
  resend_messages(LowerSeqNum, UpperSeqNum, Msgs, StmId, SessId) ->
      case queue:peek(Msgs) of
          {value, #server_message{message_stream = #message_stream{
              sequence_number = LowerSeqNum
          }} = Msg} ->
              ok = communicator:send_to_client(Msg, SessId),
              resend_messages(LowerSeqNum + 1, UpperSeqNum, queue:drop(Msgs), StmId, SessId);
          {value, #server_message{message_stream = #message_stream{
              sequence_number = SeqNum
          }}} when SeqNum < LowerSeqNum ->
              resend_messages(LowerSeqNum, UpperSeqNum, queue:drop(Msgs), StmId, SessId);
          _ ->
              ?warning("Received request for messages unavailable in sequencer stream "
              "queue. Stream ID: ~p, range: [~p,~p].", [StmId, LowerSeqNum, UpperSeqNum])
  