aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_watchdog.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-07-23 13:48:25 +0200
committerAnders Svensson <[email protected]>2013-07-23 13:48:25 +0200
commit4c4cf7d15b5179808e7e614694113e47277fd22d (patch)
tree7c1bb023ca6d0a6b3e6d7995ee98fa03bbab9596 /lib/diameter/src/base/diameter_watchdog.erl
parentaba918012baf791ea55da96fb507eae8c30238ba (diff)
parente762d7d10b045623272430a91326eb936733acf0 (diff)
downloadotp-4c4cf7d15b5179808e7e614694113e47277fd22d.tar.gz
otp-4c4cf7d15b5179808e7e614694113e47277fd22d.tar.bz2
otp-4c4cf7d15b5179808e7e614694113e47277fd22d.zip
Merge branch 'anders/diameter/inappropriate_DWR/OTP-11184' into maint
* anders/diameter/inappropriate_DWR/OTP-11184: Ensure DWR isn't sent immediately after DWA Comment tweaks
Diffstat (limited to 'lib/diameter/src/base/diameter_watchdog.erl')
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 88ccf630e2..7e75801718 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -201,7 +201,7 @@ common_dictionary(Apps) ->
%% means a user won't be able either send of receive
%% messages in the common dictionary: incoming request
%% will be answered with 3007 and outgoing requests cannot
- %% be sent. The dictionary returned here is oly used for
+ %% be sent. The dictionary returned here is only used for
%% messages diameter sends and receives: CER/CEA, DPR/DPA
%% and DWR/DWA.
?BASE
@@ -545,10 +545,15 @@ recv(Name, Pkt, S) ->
%% rcv/3
+rcv('DWR', Pkt, #watchdog{transport = TPid,
+ dictionary = Dict0,
+ sequence = Mask}) ->
+ send(TPid, {send, encode(dwa(Pkt), Mask, Dict0)}),
+ ?LOG(send, 'DWA');
+
rcv(N, _, _)
when N == 'CER';
N == 'CEA';
- N == 'DWR';
N == 'DWA';
N == 'DPR';
N == 'DPA' ->
@@ -642,6 +647,9 @@ rcv('DWA', #watchdog{status = reopen,
%% REOPEN Receive non-DWA Throwaway() REOPEN
+rcv('DWR', #watchdog{status = reopen} = S) ->
+ S; %% ensure DWA: the RFC isn't explicit about answering
+
rcv(_, #watchdog{status = reopen} = S) ->
throwaway(S).
@@ -782,6 +790,13 @@ dwr(#diameter_caps{origin_host = OH,
{'Origin-Realm', OR},
{'Origin-State-Id', OSI}].
+%% dwa/1
+
+dwa(#diameter_packet{header = H, errors = Es}) ->
+ {RC, FailedAVP} = diameter_peer_fsm:result_code(H, Es),
+ ['DWA', {'Result-Code', RC}
+ | tl(getr(dwr)) ++ FailedAVP].
+
%% restrict_nodes/1
restrict_nodes(false) ->