mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
mod_stream_mgmt: Don't crash on disabled ACK timer
Don't attempt to start an ACK timer if 'ack_timeout' is set to 'infinity'. Thanks to Ingo Jrgensmann for reporting the bug.
This commit is contained in:
parent
ec035e3c41
commit
243dc06733
@ -494,11 +494,10 @@ update_num_stanzas_in(State, _El) ->
|
||||
send_rack(#{mgmt_ack_timer := _} = State) ->
|
||||
State;
|
||||
send_rack(#{mgmt_xmlns := Xmlns,
|
||||
mgmt_stanzas_out := NumStanzasOut,
|
||||
mgmt_ack_timeout := AckTimeout} = State) ->
|
||||
TRef = erlang:start_timer(AckTimeout, self(), ack_timeout),
|
||||
State1 = State#{mgmt_ack_timer => TRef, mgmt_stanzas_req => NumStanzasOut},
|
||||
send(State1, #sm_r{xmlns = Xmlns}).
|
||||
mgmt_stanzas_out := NumStanzasOut} = State) ->
|
||||
State1 = State#{mgmt_stanzas_req => NumStanzasOut},
|
||||
State2 = start_ack_timer(State1),
|
||||
send(State2, #sm_r{xmlns = Xmlns}).
|
||||
|
||||
-spec resend_rack(state()) -> state().
|
||||
resend_rack(#{mgmt_ack_timer := _,
|
||||
@ -713,6 +712,13 @@ restart_pending_timer(#{mgmt_pending_timer := TRef} = State, NewTimeout) ->
|
||||
restart_pending_timer(State, _NewTimeout) ->
|
||||
State.
|
||||
|
||||
-spec start_ack_timer(state()) -> state().
|
||||
start_ack_timer(#{mgmt_ack_timeout := infinity} = State) ->
|
||||
State;
|
||||
start_ack_timer(#{mgmt_ack_timeout := AckTimeout} = State) ->
|
||||
TRef = erlang:start_timer(AckTimeout, self(), ack_timeout),
|
||||
State#{mgmt_ack_timer => TRef}.
|
||||
|
||||
-spec cancel_ack_timer(state()) -> state().
|
||||
cancel_ack_timer(#{mgmt_ack_timer := TRef} = State) ->
|
||||
misc:cancel_timer(TRef),
|
||||
|
Loading…
Reference in New Issue
Block a user