diff options
author | Anders Svensson <[email protected]> | 2012-11-18 19:38:51 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2012-11-18 19:38:51 +0100 |
commit | 9c9c14f0be78a1a895e23681b4825d6de0b1da4f (patch) | |
tree | b5196c62730e8e9f5c1c1ec4aa4c24b8a9820ac2 /lib/diameter/src/base/diameter_watchdog.erl | |
parent | 87241d86716ae02507a5019c3a2f822ff6b334d4 (diff) | |
parent | d78891e4e1566923164185894beee5e25151399f (diff) | |
download | otp-9c9c14f0be78a1a895e23681b4825d6de0b1da4f.tar.gz otp-9c9c14f0be78a1a895e23681b4825d6de0b1da4f.tar.bz2 otp-9c9c14f0be78a1a895e23681b4825d6de0b1da4f.zip |
Merge branch 'anders/diameter/transport_shutdown/OTP-10493' into maint
* anders/diameter/transport_shutdown/OTP-10493:
Add simple DPR suite
Correct diameter:remove_transport/2 doc
Fix broken doc link
Ensure watchdog dies with transport if DPR was sent
Remove dead clause
Implement transport_opt() disconnect_cb
Document transport_opt() disconnect_cb
Diffstat (limited to 'lib/diameter/src/base/diameter_watchdog.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_watchdog.erl | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl index d814f1afe2..d6a2d2833b 100644 --- a/lib/diameter/src/base/diameter_watchdog.erl +++ b/lib/diameter/src/base/diameter_watchdog.erl @@ -48,18 +48,19 @@ -record(watchdog, {%% PCB - Peer Control Block; see RFC 3539, Appendix A status = initial :: initial | okay | suspect | down | reopen, - pending = false :: boolean(), + pending = false :: boolean(), %% DWA tw :: 6000..16#FFFFFFFF | {module(), atom(), list()}, %% {M,F,A} -> integer() >= 0 num_dwa = 0 :: -1 | non_neg_integer(), %% number of DWAs received during reopen %% end PCB - parent = self() :: pid(), - transport :: pid() | undefined, + parent = self() :: pid(), %% service process + transport :: pid() | undefined, %% peer_fsm process tref :: reference(), %% reference for current watchdog timer message_data, %% term passed into diameter_service with message sequence :: diameter:sequence(), %% mask - restrict :: {diameter:restriction(), boolean()}}). + restrict :: {diameter:restriction(), boolean()}, + shutdown = false :: boolean()}). %% start/2 %% @@ -168,7 +169,8 @@ handle_info(T, S) -> handle_info(T, upgrade(S)). upgrade(S) -> - #watchdog{} = list_to_tuple(tuple_to_list(S) ++ [?NOMASK, {nodes, true}]). + #watchdog{} = list_to_tuple(tuple_to_list(S) + ++ [?NOMASK, {nodes, true}, false]). event(#watchdog{status = T}, #watchdog{status = T}) -> ok; @@ -225,9 +227,10 @@ transition({shutdown, Pid}, #watchdog{parent = Pid, down = S, %% sanity check stop; transition({shutdown = T, Pid}, #watchdog{parent = Pid, - transport = TPid}) -> + transport = TPid} + = S) -> TPid ! {T, self()}, - ok; + S#watchdog{shutdown = true}; %% Parent process has died, transition({'DOWN', _, process, Pid, _Reason}, @@ -301,7 +304,10 @@ transition({open = P, TPid, _Hosts, T}, transition({'DOWN', _, process, TPid, _}, #watchdog{transport = TPid, - status = initial}) -> + status = S, + shutdown = D}) + when S == initial; + D -> stop; transition({'DOWN', _, process, TPid, _}, |