anchor.diff:  connect(_, _) ->
       throw("invalid host or port to connect to").
   
  -recv_payload(Sock) ->
  +recv_once(Sock) ->
       inet:setopts(Sock, [{active,once}]),
       receive
           {tcp, Sock, <<"+FULLRESYNC", _, RunId:40/binary, _, Offset/binary>>} ->
  -            {foo, b2l(RunId), int_offset(Offset)}; % Fix my name
  +            {fullresync, b2l(RunId), int_offset(Offset)}; % Fix my name
           {tcp, _Sock, <<Bulk/binary>>} ->
  -            {stream, Bulk};
  +            {load_stream, Bulk};
           {tcp, _Sock, Data} ->
               io:format("invalid data received '~p' ~n", [Data]),
               {error, "invalid data received"};
  
positive.code: %% synchronization or just can handle whole sync.
  handle_cast(capa, S = #state{socket=Sock, state=eof}) ->
      io:format("capa ~n"),
      Type = handle_sock(capa(Sock), S), % BUG: take care of recv errors.
      gen_server:cast(self(), Type),
      {noreply, S#state{state=load, mode=Type}};
  
  %% PSYNC.
  handle_cast(psync, S = #state{socket=Sock, state=load}) ->
      io:format("psync ~n"),
      handle_sock(psync(Sock, S#state.runid, S#state.offset), S),
      {noreply, S};
  
  %% SYNC.
  handle_cast(sync, S = #state{socket=Sock, state=load}) ->
      io:format("sync ~n"),
      handle_sock(sync(Sock), S);
  
  %% RDB SAVE
  handle_cast({save_rdb, Bulk}, S = #state{socket=_Sock, state=lalala}) -> % FIXME
      io:format("save_rdb data -> ~p ~n", [Bulk]),
      ok = rdb_save(Bulk),
      gen_server:cast(self(), {load_rdb, self()}),
      {noreply, S#state{state=lalala2}}; % Next state will be 'lalala2' % FIXME
  
  %% RDB LOAD
  handle_cast({load_rdb, Pid}, S = #state{socket=_Sock, state=lalala2}) -> % FIXME
      io:format("load_rdb data -> ~p ~n", [Pid]),
      ok = rdb_load(Pid),
      %% Continue!
      {noreply, S};
  
  handle_cast(shutdown, State) ->
      io:format("Generic cast: *shutdown* while in '~p'~n",[State]),
      {stop, normal, State};
  %% Generic
  handle_cast(Msg, State) ->
      io:format("Generic cast: '~p' while in '~p'~n",[Msg, State]),
      {noreply, State}.
  
  %% Generic
  handle_call(Msg, From, State) ->
      io:format("Generic call: '~p' from '~p' while in '~p'~n",[Msg, From, State]),
      {reply, ok, State}.
  
  %handle_info({loading, list, <<Key/binary>>, [FirstElem|_]}, State) ->
  %    io:format("key '~s' -> elem '~p' ~n", [Key, FirstElem]),
  
negative.code: 
  %% Server termination
  terminate(socket_err, {S, Error}) ->
      gen_tcp:close(S#state.socket),
      io:format("Error over socket ~p ~n", [Error]);
  terminate(Reason, State) ->
      gen_tcp:close(State#state.socket),
      io:format("Generic termination: '~p' '~p'~n",[Reason, State]).
  
  %
  