anchor.diff:              end
       end.
   
  +-spec reconnect(state()) -> inet:socket() | fail.
  +reconnect(State) ->
  +    Address = dest_ip(State),
  +    Port = dest_port(State),
  +    MyPort = local_listen_port(State),
  +    Channel = channel(State),
  +    new_connection(Address, Port, MyPort, Channel, 0).
  +
   -spec close_connection(Socket::inet:socket(), State::state()) -> state().
   close_connection(Socket, State) ->
       gen_tcp:close(Socket),
  
positive.code:             %% only close in case of no_keep_alive if the
              %% connection was solely initiated for this send
              case lists:member({no_keep_alive}, Options)
                       andalso s_msg_count_session(State2) =< 1 of
                  true -> close_connection(Socket, State2);
                  _    -> State2
              end;
          {error, closed} ->
              Address = dest_ip(State),
              Port = dest_port(State),
              report_bundle_error(Options, {Address, Port, Pid}, Message,
                                  socket_closed),
              log:log(warn,"[ CC ~p (~p) ] sending closed connection", [self(), pid_groups:my_pidname()]),
              close_connection(Socket, State);
          {error, timeout} ->
              if  % retry 5 times
                  NumberOfTimeouts < 5 ->
                      log:log(error,"[ CC ~p (~p) ] couldn't send message (~.0p). retrying.",
                              [self(), pid_groups:my_pidname(), timeout]),
                      send_internal(Pid, Message, Options, BinaryMessage, State, NumberOfTimeouts + 1);
                  true ->
                      log:log(error,"[ CC ~p (~p) ] couldn't send message (~.0p). retried 5 times, now closing the connection.",
                              [self(), pid_groups:my_pidname(), timeout]),
  
negative.code: send(Pid, Message, Options, State) ->
      DeliverMsg = {?deliver, Pid, Message},
      BinaryMessage = ?COMM_COMPRESS_MSG(DeliverMsg, State),
      send_internal(Pid, Message, Options, BinaryMessage, State, 0, 0).
  
  -spec send_internal
      (pid(), comm:message(), comm:send_options(), BinMsg::binary(), state(), Timeouts::non_neg_integer(), Errors::non_neg_integer())
          -> state();
      (?unpack_msg_bundle, [{pid(), comm:message()}], [comm:send_options()], BinMsg::binary(), state(), Timeouts::non_neg_integer(), Errors::non_neg_integer())
          -> state().
  send_internal(Pid, Message, Options, BinaryMessage, State, Timeouts, Errors) ->
      Socket = socket(State),
      ?LOG_MESSAGE_SOCK('send', Message, byte_size(BinaryMessage), channel(State)),
      case gen_tcp:send(Socket, BinaryMessage) of
  