Permalink
Browse files

On query response, cancel the timer for queries comming from the mysq…

…l gen_server.

This avoid useless timeout messages to be delivered to that gen_server

git-svn-id: http://svn.process-one.net/ejabberd-modules/mysql/trunk@1030 d5c1f840-3623-0410-9cd6-eede35f65a94
  • Loading branch information...
1 parent 700eb18 commit e07f15144ce2da09392250f62b007958cc3ac066 ppolvorin committed Nov 4, 2009
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/mysql_conn.erl
View
@@ -215,6 +215,7 @@ wait_fetch_result(TRef, Pid) ->
stop(Pid) ->
Pid ! close.
+
%%--------------------------------------------------------------------
%% Function: do_recv(LogFun, RecvPid, SeqNum)
%% LogFun = undefined | function() with arity 3
@@ -316,6 +317,10 @@ loop(State) ->
%% The query was not sent using gen_server mechanisms
GenSrvFrom ! {fetch_result, Ref, self(), Res};
false ->
+ %% the timer is canceled in wait_fetch_result/2, but we wait on that funtion only if the query
+ %% was not sent using the mysql gen_server. So we at least should try to cancel the timer here
+ %% (no warranty, the gen_server can still receive timeout messages)
+ erlang:cancel_timer(Ref),
gen_server:reply(GenSrvFrom, Res)
end,
loop(State);

0 comments on commit e07f151

Please sign in to comment.