anchor.diff:  terminate(_Reason, _State) -> ok.
   
   code_change(_OldVsn, State, _Extra) -> {ok, State}.
  +
  +safe_peername(Skt, Mod) ->
  +    case Mod:peername(Skt) of
  +        {ok, Info} ->
  +            Info;
  +        _ ->
  +            {unknown, unknown}                  % Real info is {Addr, Port}
  +    end.
  
positive.code:     Socket = if SslOpts /= [] ->
                       {ok, Skt} = ssl:ssl_accept(Socket0, SslOpts, 30*1000),
                       ok = ssl:setopts(Skt, SockOpts),
                       Skt;
                  true ->
                       ok = inet:setopts(Socket0, SockOpts),
                       Socket0
               end,
      {reply, ok, State#state { sock = Socket }}.
  
  handle_info({tcp_closed,_Socket},State=#state{partition=Partition,count=Count}) ->
      lager:info("Handoff receiver for partition ~p exited after processing ~p"
                            " objects", [Partition, Count]),
      {stop, normal, State};
  handle_info({tcp_error, _Socket, _Reason}, State=#state{partition=Partition,count=Count}) ->
      lager:info("Handoff receiver for partition ~p exited after processing ~p"
                            " objects", [Partition, Count]),
      {stop, normal, State};
  handle_info({tcp, Socket, Data}, State) ->
      [MsgType|MsgData] = Data,
      case catch(process_message(MsgType, MsgData, State)) of
          {'EXIT', Reason} ->
              lager:error("Handoff receiver for partition ~p exited abnormally after "
                                     "processing ~p objects: ~p", [State#state.partition, State#state.count, Reason]),
              {stop, normal, State};
          NewState when is_record(NewState, state) ->
              InetMod = if NewState#state.ssl_opts /= [] -> ssl;
  
negative.code:          terminate/2, code_change/3]).
  
  -record(state, {sock :: port(),
                  peer :: term(),
                  ssl_opts :: [] | list(),
                  tcp_mod :: atom(),
                  timeout_len :: non_neg_integer(),
  