anchor.diff:          {error, Reason} -> % BUG in here!!
               {stop, socket_err, {S, Reason}}
       end;
  +
  +handle_sock(ok, S = #state{socket=Sock, state=reconnect2}) ->
  +    case recv_sock(Sock) of
  +        {ok, _} ->
  +            gen_server:cast(self(), bar),
  +            {noreply, S#state{state=reconnect3}};
  +        {error, Reason} ->
  +            {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"),
  
positive.code:     inet:setopts(Sock, [{active,once}]),
      receive
          % "-LOADING"
          {tcp, Sock, <<"+OK", _/binary>>} ->
              {ok, psync};
          {tcp, Sock, <<"+PONG", _/binary>>} ->
              {ok, pong, Sock};
          {tcp, Sock, <<"+FULLRESYNC", _, RunId:40/binary, _, Offset/binary>>} ->
              {ok, fullresync, b2l(RunId), int_offset(Offset)};
          {tcp, _Sock, <<"-ERR Unrecognized REPLCONF", _/binary>>} ->
              {ok, sync};
  
negative.code: 
  repl_ack(Sock, Offset) when is_integer(Offset) ->
      % "*3\r\n$8\r\nREPLCONF\r\n$3\r\nACK\r\n$%d\r\n%s\r\n"
      OffSize = byte_size(i2b(Offset)), %% Offset size
      Repl = [rlen(3), ?CRLF, rsize(8), ?CRLF, <<"REPLCONF">>, ?CRLF,
              rsize(3),?CRLF, <<"ACK">>,?CRLF, rsize(OffSize), ?CRLF, i2b(Offset)],
      send_pkg(Sock, Repl).
  
  sync(Sock) ->
      send_pkg(Sock, [<<"SYNC">>]).
  