timer:seconds
This commit is contained in:
parent
048ad27b65
commit
22170b6c6d
|
@ -42,7 +42,7 @@
|
|||
%%------------------------------------------------------------------------------
|
||||
new({Transport, Socket}, TimeoutSec, TimeoutMsg) when TimeoutSec > 0 ->
|
||||
{ok, [{recv_oct, RecvOct}]} = Transport:getstat(Socket, [recv_oct]),
|
||||
Ref = erlang:send_after(TimeoutSec*1000, self(), TimeoutMsg),
|
||||
Ref = erlang:send_after(timer:seconds(TimeoutSec), self(), TimeoutMsg),
|
||||
#keepalive {transport = Transport,
|
||||
socket = Socket,
|
||||
recv_oct = RecvOct,
|
||||
|
@ -67,7 +67,7 @@ resume(KeepAlive = #keepalive {transport = Transport,
|
|||
true ->
|
||||
%need?
|
||||
cancel(Ref),
|
||||
NewRef = erlang:send_after(TimeoutSec*1000, self(), TimeoutMsg),
|
||||
NewRef = erlang:send_after(timer:seconds(TimeoutSec), self(), TimeoutMsg),
|
||||
{resumed, KeepAlive#keepalive{recv_oct = NewRecvOct, timer_ref = NewRef}}
|
||||
end.
|
||||
|
||||
|
|
|
@ -664,8 +664,8 @@ next_packet_id(Session = #session{packet_id = 16#ffff}) ->
|
|||
next_packet_id(Session = #session{packet_id = Id}) ->
|
||||
Session#session{packet_id = Id + 1}.
|
||||
|
||||
timer(Timeout, TimeoutMsg) ->
|
||||
erlang:send_after(Timeout * 1000, self(), TimeoutMsg).
|
||||
timer(TimeoutSec, TimeoutMsg) ->
|
||||
erlang:send_after(timer:seconds(TimeoutSec), self(), TimeoutMsg).
|
||||
|
||||
cancel_timer(undefined) ->
|
||||
undefined;
|
||||
|
@ -679,7 +679,7 @@ start_collector(Session = #session{collect_interval = 0}) ->
|
|||
Session;
|
||||
|
||||
start_collector(Session = #session{collect_interval = Interval}) ->
|
||||
TRef = erlang:send_after(Interval * 1000, self(), collect_info),
|
||||
TRef = erlang:send_after(timer:seconds(Interval), self(), collect_info),
|
||||
Session#session{collect_timer = TRef}.
|
||||
|
||||
info(#session{clean_sess = CleanSess,
|
||||
|
|
Loading…
Reference in New Issue