24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-06 23:22:36 +02:00

[TECH-1511] debug traces reorganized

This commit is contained in:
Eric Cestari 2010-09-16 15:08:53 +02:00
parent cb54444f00
commit a45ecb70ff
4 changed files with 5 additions and 15 deletions

View File

@ -75,7 +75,7 @@ update_reg_users_counter_table(Server) ->
mnesia:sync_dirty(F).
plain_password_required() ->
true.
false.
check_password(User, Server, Password) ->
LUser = jlib:nodeprep(User),

View File

@ -330,10 +330,6 @@ process(Handlers, #ws{} = Ws)->
(HandlerPathPrefix==Ws#ws.path)) of
true ->
?DEBUG("~p matches ~p", [Ws#ws.path, HandlerPathPrefix]),
%% LocalPath is the path "local to the handler", i.e. if
%% the handler was registered to handle "/test/" and the
%% requested path is "/test/foo/bar", the local path is
%% ["foo", "bar"]
LocalPath = lists:nthtail(length(HandlerPathPrefix), Ws#ws.path),
ejabberd_hooks:run(ws_debug, [{LocalPath, Ws}]),
ejabberd_websocket:connect(Ws#ws{local_path = LocalPath}, HandlerModule);
@ -410,6 +406,7 @@ process_request(#state{request_method = Method,
headers = RequestHeaders
},
process(WebSocketHandlers, Ws),
?DEBUG("It is a websocket.",[]),
none;
false ->
Request = #request{method = Method,
@ -422,7 +419,6 @@ process_request(#state{request_method = Method,
tp = TP,
headers = RequestHeaders,
ip = IP},
?DEBUG("It is not a websocket.",[]),
case process(RequestHandlers, Request) of
El when element(1, El) == xmlelement ->
make_xhtml_output(State, 200, [], El);

View File

@ -76,7 +76,7 @@ start(WS) ->
supervisor:start_child(ejabberd_wsloop_sup, [WS]).
start_link(WS) ->
gen_fsm:start_link(?MODULE, [WS],[{debug, [trace]}]).
gen_fsm:start_link(?MODULE, [WS],?FSMOPTS).
send({http_ws, FsmRef, _IP}, Packet) ->
gen_fsm:sync_send_all_state_event(FsmRef, {send, Packet}).

View File

@ -44,7 +44,6 @@
-include("ejabberd_http.hrl").
check(_Path, Headers)->
%?DEBUG("testing for a websocket request path: ~p headers: ~p", [_Path, Headers]),
% set supported websocket protocols, order does matter
VsnSupported = [{'draft-hixie', 76}, {'draft-hixie', 68}],
% checks
@ -198,7 +197,7 @@ ws_loop(Socket, Buffer, WsHandleLoopPid, SocketMode, WsAutoExit) ->
{tcp, Socket, Data} ->
handle_data(Buffer, binary_to_list(Data), Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
{tcp_closed, Socket} ->
%?DEBUG("tcp connection was closed, exit", []),
?DEBUG("tcp connection was closed, exit", []),
% close websocket and custom controlling loop
websocket_close(Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
{'DOWN', Ref, process, WsHandleLoopPid, Reason} ->
@ -218,7 +217,7 @@ ws_loop(Socket, Buffer, WsHandleLoopPid, SocketMode, WsAutoExit) ->
SocketMode:send(Socket, [0, Data, 255]),
ws_loop(Socket, Buffer, WsHandleLoopPid, SocketMode, WsAutoExit);
shutdown ->
%?DEBUG("shutdown request received, closing websocket with pid ~p", [self()]),
?DEBUG("shutdown request received, closing websocket with pid ~p", [self()]),
% close websocket and custom controlling loop
websocket_close(Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
_Ignored ->
@ -228,24 +227,19 @@ ws_loop(Socket, Buffer, WsHandleLoopPid, SocketMode, WsAutoExit) ->
% Buffering and data handling
handle_data(none, [0|T], Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
%?DEBUG("handle_data 1", []),
handle_data([], T, Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
handle_data(none, [], Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
%?DEBUG("handle_data 2", []),
ws_loop(Socket, none, WsHandleLoopPid, SocketMode, WsAutoExit);
handle_data(L, [255|T], Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
%?DEBUG("handle_data 3", []),
WsHandleLoopPid ! {browser, lists:reverse(L)},
handle_data(none, T, Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
handle_data(L, [H|T], Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
%?DEBUG("handle_data 4, Buffer = ~p", [L]),
handle_data([H|L], T, Socket, WsHandleLoopPid, SocketMode, WsAutoExit);
handle_data([], L, Socket, WsHandleLoopPid, SocketMode, WsAutoExit) ->
%?DEBUG("handle_data 5", []),
ws_loop(Socket, L, WsHandleLoopPid, SocketMode, WsAutoExit).
% Close socket and custom handling loop dependency