anchor.diff:  %% in which state is.
   handle_sock(ok, S = #state{socket=Sock, state=list}) ->
       io:format("doing list ~n"),
  -    case recv_repl(Sock) of
  +    case recv_sock(Sock) of
           {ok, _} ->
               gen_server:cast(self(), capa),
               {noreply, S#state{state=eof}}; % Next state will be 'eof'
  -        {error, Error} ->
  -            {stop, socket_err, {S, Error}}
  +        {error, Reason} ->
  +            {stop, socket_err, {S, Reason}}
       end;
   %% Get type of synchronization
   handle_sock(ok, S = #state{socket=Sock, state=eof}) ->
       io:format("doing eof ~n"),
  -    case recv_repl(Sock) of
  +    case recv_sock(Sock) of
           {ok, Type} ->
               gen_server:cast(self(), Type),
               {noreply, S#state{state=load, mode=Type}};
  -        {error, Error} -> % BUG in here!!
  -            {stop, socket_err, {S, Error}}
  +        {error, Reason} -> % BUG in here!!
  +            {stop, socket_err, {S, Reason}}
       end;
   %% Receive the payload from de synchronization command 'sync'
   handle_sock(ok, S = #state{socket=Sock, state=load, mode=sync}) ->
       io:format("getting payload sync ~n"),
  -    handle_recv(recv_once(Sock), S);
  +    handle_recv(recv_sock(Sock), S);
   
   handle_sock(ok, S = #state{socket=Sock, state=load, mode=psync}) ->
       io:format("getting payload psync 1st ~n"),
  -    handle_recv(recv_once(Sock), S);
  +    handle_recv(recv_sock(Sock), S);
   
   handle_sock(get_payload, S = #state{socket=Sock, state=payload, mode=psync}) ->
       io:format("getting payload psync 2nd ~n"),
  -    handle_recv(recv_once(Sock), S);
  -
  -handle_sock({error, Error}, S) ->
  -    {stop, socket_err, {S, Error}};
  +    handle_recv(recv_sock(Sock), S);
  +
  +handle_sock({error, Reason}, S) ->
  +    {stop, socket_err, {S, Reason}};
   handle_sock(_,_) ->
       {stop, general, "general socket error"}.
   
  
positive.code:     Sock = connect(Addr, Port),
      case ping(Sock) of
          ok ->
              recv_pong(Sock);
          {error, timeout} ->
              io:format("Send timeout, closing! ~n"),
              gen_tcp:close(Sock),
  
negative.code: handle_info({loading, eof}, State) ->
      io:format("rdb synchronization completed ~n"),
      {noreply, State};
  
  handle_info({tcp, Sock, Data}, State) ->
      io:format("tcp stream: '~p' '~p'~n",[Data, State]),
      inet:setopts(Sock, [{active,once}]),
      {noreply, State};
  %% Generic
  handle_info(Msg, State) ->
      io:format("Generic info: '~p' '~p'~n",[Msg, State]),
      {noreply, State}.
  