aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-05-21 00:46:56 +0200
committerAnders Svensson <[email protected]>2014-05-22 02:15:09 +0200
commit90cd10632ff2bcc6c541ac544728f18097290301 (patch)
treebf37b4ce9f7636a51f2b850c69ecd8375b2bce8e /lib/diameter/src
parentd6b3b84abeef4a323a3ddfd89c9a6b131bcd11fc (diff)
downloadotp-90cd10632ff2bcc6c541ac544728f18097290301.tar.gz
otp-90cd10632ff2bcc6c541ac544728f18097290301.tar.bz2
otp-90cd10632ff2bcc6c541ac544728f18097290301.zip
Count decode errors independently of result codes
Since the former doesn't exclude the latter. Counter values are returned by diameter:service_info/2. They can currently only be retrieved for a service, not for individual transports or peer connections.
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 34f08a2710..908f5ff9bf 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -635,7 +635,7 @@ reply(Msg, Dict, TPid, Dict0, Fs, ReqPkt) ->
Pkt = encode(Dict,
reset(make_answer_packet(Msg, ReqPkt), Dict, Dict0),
Fs),
- incr_A(send, Pkt, Dict, TPid, Dict0), %% count outgoing result codes
+ incr_A(send, Pkt, Dict, TPid, Dict0), %% count outgoing
send(TPid, Pkt).
%% reset/3
@@ -1010,18 +1010,20 @@ find(Pred, [H|T]) ->
incr_A(_, #diameter_packet{msg = undefined = No}, _, _, _) ->
No;
-%% Incoming with decode errors.
-incr_A(recv = D, #diameter_packet{header = H, errors = [_|_]}, _, TPid, _) ->
- incr(TPid, {diameter_codec:msg_id(H), D, error});
-
-%% Incoming without errors or outgoing. Outgoing with encode errors
-%% never gets here since encode fails.
+%% Incoming or outgoing. Outgoing with encode errors never gets here
+%% since encode fails.
incr_A(Dir, Pkt, Dict, TPid, Dict0) ->
#diameter_packet{header = #diameter_header{is_error = E}
= Hdr,
- msg = Msg}
+ msg = Msg,
+ errors = Es}
= Pkt,
+ Id = diameter_codec:msg_id(Hdr),
+
+ %% Count incoming decode errors.
+ recv /= Dir orelse [] == Es orelse incr(TPid, {Id, Dir, error}),
+
%% Exit on a missing result code.
T = rc_counter(Dict, Msg),
T == false andalso x(no_result_code, answer, [Dir, Pkt]),
@@ -1031,7 +1033,7 @@ incr_A(Dir, Pkt, Dict, TPid, Dict0) ->
is_result(RC, E, Dict0)
orelse x({invalid_error_bit, RC}, answer, [Dir, Pkt]),
- incr(TPid, {diameter_codec:msg_id(Hdr), Dir, Ctr}).
+ incr(TPid, {Id, Dir, Ctr}).
%% No E-bit: can't be 3xxx.
is_result(RC, false, _Dict0) ->
@@ -1408,7 +1410,7 @@ handle_answer(SvcName,
handle_A(Pkt, SvcName, Dict, Dict0, App, #request{transport = TPid} = Req) ->
try
- incr_A(recv, Pkt, Dict, TPid, Dict0) %% count incoming result codes
+ incr_A(recv, Pkt, Dict, TPid, Dict0) %% count incoming
of
_ -> answer(Pkt, SvcName, App, Req)
catch