25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-08 15:42:29 +01:00

fixes timeout calculation

This commit is contained in:
Evgeniy Khramtsov 2010-10-14 20:11:44 +10:00
parent 4a6fc46713
commit 254686ab46

View File

@ -573,8 +573,8 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod, _Time,
{ok, Clone} -> {ok, Clone} ->
process_flag(trap_exit, true), process_flag(trap_exit, true),
MRef = erlang:monitor(process, Clone), MRef = erlang:monitor(process, Clone),
NowDiff = timer:now_diff(now(), Now), NowDiff = timer:now_diff(now(), Now) div 1000,
TimeLeft = lists:max([Time1 - NowDiff, 0]) div 1000, TimeLeft = lists:max([Time1 - NowDiff, 0]),
TRef = erlang:start_timer(TimeLeft, self(), timeout), TRef = erlang:start_timer(TimeLeft, self(), timeout),
relay_messages(MRef, TRef, Clone, Queue); relay_messages(MRef, TRef, Clone, Queue);
Reply -> Reply ->
@ -636,8 +636,8 @@ handle_msg(Msg, Parent, Name, StateName, StateData,
{ok, Clone} -> {ok, Clone} ->
process_flag(trap_exit, true), process_flag(trap_exit, true),
MRef = erlang:monitor(process, Clone), MRef = erlang:monitor(process, Clone),
NowDiff = timer:now_diff(now(), Now), NowDiff = timer:now_diff(now(), Now) div 1000,
TimeLeft = lists:max([Time1 - NowDiff, 0]) div 1000, TimeLeft = lists:max([Time1 - NowDiff, 0]),
TRef = erlang:start_timer(TimeLeft, self(), timeout), TRef = erlang:start_timer(TimeLeft, self(), timeout),
relay_messages(MRef, TRef, Clone, Queue); relay_messages(MRef, TRef, Clone, Queue);
Reply -> Reply ->