mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Dialyzer fixes in cowboy_clock
This is what I get for merging blindly! and Fix a compile error introduced in previous commit (cherry-pick)
This commit is contained in:
parent
674e5a61e2
commit
9b424fec2b
1 changed files with 6 additions and 6 deletions
|
@ -36,7 +36,7 @@
|
||||||
-record(state, {
|
-record(state, {
|
||||||
universaltime = undefined :: undefined | calendar:datetime(),
|
universaltime = undefined :: undefined | calendar:datetime(),
|
||||||
rfc1123 = <<>> :: binary(),
|
rfc1123 = <<>> :: binary(),
|
||||||
tref = undefined :: undefined | timer:tref()
|
tref = undefined :: undefined | reference()
|
||||||
}).
|
}).
|
||||||
|
|
||||||
%% API.
|
%% API.
|
||||||
|
@ -69,11 +69,11 @@ init([]) ->
|
||||||
ets:insert(?MODULE, {rfc1123, B}),
|
ets:insert(?MODULE, {rfc1123, B}),
|
||||||
{ok, #state{universaltime=T, rfc1123=B, tref=TRef}}.
|
{ok, #state{universaltime=T, rfc1123=B, tref=TRef}}.
|
||||||
|
|
||||||
-spec handle_call(any(), _, State)
|
-type from() :: {pid(), term()}.
|
||||||
-> {reply, ignored, State} | {stop, normal, stopped, State}
|
-spec handle_call
|
||||||
|
(stop, from(), State) -> {stop, normal, stopped, State}
|
||||||
when State::#state{}.
|
when State::#state{}.
|
||||||
handle_call(stop, _From, State=#state{tref=TRef}) ->
|
handle_call(stop, _From, State) ->
|
||||||
{ok, cancel} = timer:cancel(TRef),
|
|
||||||
{stop, normal, stopped, State};
|
{stop, normal, stopped, State};
|
||||||
handle_call(_Request, _From, State) ->
|
handle_call(_Request, _From, State) ->
|
||||||
{reply, ignored, State}.
|
{reply, ignored, State}.
|
||||||
|
@ -85,7 +85,7 @@ handle_cast(_Msg, State) ->
|
||||||
-spec handle_info(any(), State) -> {noreply, State} when State::#state{}.
|
-spec handle_info(any(), State) -> {noreply, State} when State::#state{}.
|
||||||
handle_info(update, #state{universaltime=Prev, rfc1123=B1, tref=TRef0}) ->
|
handle_info(update, #state{universaltime=Prev, rfc1123=B1, tref=TRef0}) ->
|
||||||
%% Cancel the timer in case an external process sent an update message.
|
%% Cancel the timer in case an external process sent an update message.
|
||||||
erlang:cancel_timer(TRef0),
|
_ = erlang:cancel_timer(TRef0),
|
||||||
T = erlang:universaltime(),
|
T = erlang:universaltime(),
|
||||||
B2 = update_rfc1123(B1, Prev, T),
|
B2 = update_rfc1123(B1, Prev, T),
|
||||||
ets:insert(?MODULE, {rfc1123, B2}),
|
ets:insert(?MODULE, {rfc1123, B2}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue