anchor.diff:          true ->
               case vmq_reg:register_client(ClientId, CleanSession) of
                   ok ->
  +                    io:format(user, "[~p] registered client ~p ~p~n", [node(), ClientId, self()]),
                       vmq_hook:all(on_register, [Peer, ClientId, User, Password]),
                       check_will(F, State#state{username=User});
                   {error, Reason} ->
  
positive.code:     {next_state, wait_for_connect, State, ?CLOSE_AFTER}.
  
  -spec connected(timeout
                  | disconnect
                  | keepalive_expired
                  | {retry, msg_id()}
                  | {deliver_bin, {msg_id(), qos(), payload()}}
  
negative.code: 
  -spec disconnect(pid()) -> ok.
  disconnect(FsmPid) ->
      gen_fsm:send_all_state_event(FsmPid, disconnect).
  
  -spec in(pid(), #mqtt_frame{}) ->  ok.
  in(FsmPid, Event) ->
  