anchor.diff:  
   
   initializing(_, State) ->
  -    {infinity, State}.
  +    %% TODO incomplete
  +    {noreply, State#state{on_message = fun on_message/2}}.
   
   on_message({$N, Data}, State) ->
       %% TODO use it
  
positive.code: auth(_Username, Password, {$R, <<3:?int32>>}, State) ->
      #state{timeout = Timeout} = State,
      send(State, $p, [Password, 0]),
      {State, Timeout};
  
  %% AuthenticationMD5Password
  auth(Username, Password, {$R, <<5:?int32, Salt:4/binary>>}, State) ->
  
negative.code:     OnTimeout(State);
  
  handle_info({_, Sock, Data2}, #state{data = Data, sock = Sock} = State) ->
      loop(State#state{data = <<Data/binary, Data2/binary>>}, infinity).
  
  loop(#state{data = Data, on_message = OnMessage} = State, Timeout) ->
      case pgsql_wire:decode_message(Data) of
          {Message, Tail} ->
              case OnMessage(Message, State#state{data = Tail}) of
                  {noreply, State2} ->
                      loop(State2, infinity);
                  {noreply, State2, Timeout2} ->
                      loop(State2, Timeout2);
                  R = {stop, _Reason2, _State2} ->
                      R
              end;
          _ ->
              {noreply, State, Timeout}
      end.
  