aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-05-26 09:19:52 +0200
committerAnders Svensson <[email protected]>2014-05-26 09:19:52 +0200
commit33d93dd68404d567b2dfb7a5b9ffcf5f525dcd3c (patch)
tree53abea67828a8f1d7afb6c589842d1cb4f3332f9
parentb1d450019e1629db599e56ee6b1e4296cc8d039d (diff)
parentb1138f27083b1d36a6a20e1d2538b3fbaff61702 (diff)
downloadotp-33d93dd68404d567b2dfb7a5b9ffcf5f525dcd3c.tar.gz
otp-33d93dd68404d567b2dfb7a5b9ffcf5f525dcd3c.tar.bz2
otp-33d93dd68404d567b2dfb7a5b9ffcf5f525dcd3c.zip
Merge branch 'anders/diameter/dpr/OTP-11938' into maint
* anders/diameter/dpr/OTP-11938: Ensure watchdog dies with transport if DPA was sent
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl6
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl7
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index 4b97fa96b3..32e1b91966 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -678,8 +678,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).
@@ -743,8 +741,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 dbfe087659..e89b1394ee 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -329,6 +329,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}) ->
@@ -400,7 +405,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}) ->