diff options
author | Anders Svensson <[email protected]> | 2014-05-22 22:38:53 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2014-05-23 16:12:04 +0200 |
commit | b1138f27083b1d36a6a20e1d2538b3fbaff61702 (patch) | |
tree | 74e33f886f9b3da01959d104f3f77067e5368fbc /lib | |
parent | 53aa56b26eeb97c99bd125b53121f5a3f4767949 (diff) | |
download | otp-b1138f27083b1d36a6a20e1d2538b3fbaff61702.tar.gz otp-b1138f27083b1d36a6a20e1d2538b3fbaff61702.tar.bz2 otp-b1138f27083b1d36a6a20e1d2538b3fbaff61702.zip |
Ensure watchdog dies with transport if DPA was sent
A DPR/DPA exchange should always cause the watchdog process in question
to die with the transport, so that a subsequent connection with the same
peer doesn't result in a 3 x DWR/DWA exchange. Commit 5903d6db saw to
this for the sending of DPR but neglected the corresponding problem for
DPA.
In the case of sending DPR (the aforementioned commit), note that
there's no distinction between receiving DPA as expected and not: the
watchdog dies with the transport regardless.
diameter_watchdog must be loaded first at upgrade.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diameter/src/base/diameter_peer_fsm.erl | 8 | ||||
-rw-r--r-- | lib/diameter/src/base/diameter_watchdog.erl | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl index 282276827f..912c1b70b4 100644 --- a/lib/diameter/src/base/diameter_peer_fsm.erl +++ b/lib/diameter/src/base/diameter_peer_fsm.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2013. All Rights Reserved. +%% Copyright Ericsson AB 2010-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -662,8 +662,6 @@ send_answer(Type, ReqPkt, #state{transport = TPid, dictionary = Dict} = S) -> eval([F|A], S) -> apply(F, A ++ [S]); -eval(ok, S) -> - S; eval(T, _) -> close(T). @@ -727,8 +725,8 @@ cea(CEA, RC, Dict0) -> post('CER' = T, RC, Pkt, S) -> {T, caps(S), {RC, Pkt}}; -post('DPR', _, _, _) -> - ok. +post('DPR' = T, _, _, #state{parent = Pid}) -> + [fun(S) -> Pid ! {T, self()}, S end]. rejected({capabilities_cb, _F, Reason}, T, S) -> rejected(Reason, T, S); diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl index 9ec291897e..fb6e9f700d 100644 --- a/lib/diameter/src/base/diameter_watchdog.erl +++ b/lib/diameter/src/base/diameter_watchdog.erl @@ -344,6 +344,11 @@ transition({shutdown = T, Pid, Reason}, #watchdog{parent = Pid, send(TPid, {T, self(), Reason}), S#watchdog{shutdown = true}; +%% Transport is telling us that DPA has been sent in response to DPR: +%% its death should lead to ours. +transition({'DPR', TPid}, #watchdog{transport = TPid} = S) -> + S#watchdog{shutdown = true}; + %% Parent process has died, transition({'DOWN', _, process, Pid, _Reason}, #watchdog{parent = Pid}) -> @@ -415,7 +420,7 @@ transition({open = Key, TPid, _Hosts, T}, %% REOPEN Connection down CloseConnection() %% SetWatchdog() DOWN -%% Transport has died after service requested termination ... +%% Transport has died after DPA or service requested termination ... transition({'DOWN', _, process, TPid, _Reason}, #watchdog{transport = TPid, shutdown = true}) -> |