25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Removed a couple of expensive function calls used as arguments for

?DEBUG macros. All arguments used in the ?DEBUG macro are strictly 
evaluated (even if the loglevel is higher). 
The same is true for all log macros defined in ejabberd.hrl.  
We might need to use lazy evaluation for the arguments, when they 
are expensive to generate (wrap the arguments lists in a fun).

SVN Revision: 1915
This commit is contained in:
Pablo Polvorin 2009-02-24 03:04:58 +00:00
parent acae6e20de
commit 3119badb2b
4 changed files with 11 additions and 3 deletions

View File

@ -8,6 +8,14 @@
sql-escape it. The escaped value returned is allways a list() sql-escape it. The escaped value returned is allways a list()
(ejabberd's odbc drivers only works on lists()) (ejabberd's odbc drivers only works on lists())
* src/ejabberd_c2s.erl, src/mod_caps.erl, src/ejabberd_receiver.erl:
Removed a couple of expensive function calls used as arguments for
?DEBUG macros. All arguments used in the ?DEBUG macro are strictly
evaluated (even if the loglevel is higher). The same is true for
all log macros defined in ejabberd.hrl. We might need to use lazy
evaluation for the arguments, when they are expensive to generate
(wrap the arguments lists in a fun).
2009-02-23 Christophe Romain <christophe.romain@process-one.net> 2009-02-23 Christophe Romain <christophe.romain@process-one.net>
* src/ejabberd_c2s.erl: Do not call mod_caps:clear_caps, this previous * src/ejabberd_c2s.erl: Do not call mod_caps:clear_caps, this previous

View File

@ -1277,7 +1277,7 @@ change_shaper(StateData, JID) ->
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper). (StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).
send_text(StateData, Text) -> send_text(StateData, Text) ->
?DEBUG("Send XML on stream = ~p", [lists:flatten(Text)]), ?DEBUG("Send XML on stream = ~s", [Text]),
(StateData#state.sockmod):send(StateData#state.socket, Text). (StateData#state.sockmod):send(StateData#state.socket, Text).
send_element(StateData, #xmlel{ns = ?NS_XMPP, name = 'stream'} = El) -> send_element(StateData, #xmlel{ns = ?NS_XMPP, name = 'stream'} = El) ->

View File

@ -302,7 +302,7 @@ process_data(Data,
#state{xml_stream_state = XMLStreamState, #state{xml_stream_state = XMLStreamState,
shaper_state = ShaperState, shaper_state = ShaperState,
c2s_pid = C2SPid} = State) -> c2s_pid = C2SPid} = State) ->
?DEBUG("Received XML on stream = ~p", [binary_to_list(Data)]), ?DEBUG("Received XML on stream = ~p", [Data]),
{ok, XMLStreamState1} = exmpp_xmlstream:parse(XMLStreamState, Data), {ok, XMLStreamState1} = exmpp_xmlstream:parse(XMLStreamState, Data),
{NewShaperState, Pause} = shaper:update(ShaperState, size(Data)), {NewShaperState, Pause} = shaper:update(ShaperState, size(Data)),
HibTimeout = HibTimeout =

View File

@ -311,7 +311,7 @@ handle_cast({disco_response, From, _To, #iq{id = ID, type = Type, payload = Payl
%gen_server:cast(self(), visit_feature_queries), %gen_server:cast(self(), visit_feature_queries),
%?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:jid_to_list(From), SubEls]); %?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:jid_to_list(From), SubEls]);
{result, Payload} -> {result, Payload} ->
?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_list(From), Payload]); ?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_binary(From), Payload]);
_ -> _ ->
%% Can't do anything about errors %% Can't do anything about errors
ok ok