diff options
Diffstat (limited to 'lib/diameter/src/base/diameter_peer_fsm.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_peer_fsm.erl | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl index ac87c1a2c1..4b97fa96b3 100644 --- a/lib/diameter/src/base/diameter_peer_fsm.erl +++ b/lib/diameter/src/base/diameter_peer_fsm.erl @@ -292,7 +292,8 @@ handle_info(T, #state{} = State) -> ?LOG(stop, T), {stop, {shutdown, T}, State} catch - exit: {diameter_codec, encode, _} = Reason -> + exit: {diameter_codec, encode, T} = Reason -> + incr_error(send, T), ?LOG(stop, Reason), %% diameter_codec:encode/2 emits an error report. Only %% indicate the probable reason here. @@ -615,7 +616,7 @@ rcv('DPA' = N, transport = TPid, dpr = {Hid, Eid}}) -> - incr_A(recv, diameter_codec:decode(Dict0, Pkt), Dict0), + incr_rc(recv, diameter_codec:decode(Dict0, Pkt), Dict0), diameter_peer:close(TPid), {stop, N}; @@ -623,10 +624,15 @@ rcv('DPA' = N, rcv(_, _, _) -> ok. -%% incr_A/3 +%% incr_rc/3 -incr_A(Dir, Pkt, Dict0) -> - diameter_traffic:incr_A(Dir, Pkt, self(), Dict0). +incr_rc(Dir, Pkt, Dict0) -> + diameter_traffic:incr_rc(Dir, Pkt, self(), Dict0). + +%% incr_error/2 + +incr_error(Dir, Pkt) -> + diameter_traffic:incr_error(Dir, Pkt, self()). %% send/2 @@ -646,6 +652,8 @@ handle_request(Type, #diameter_packet{} = Pkt, #state{dictionary = D} = S) -> %% send_answer/3 send_answer(Type, ReqPkt, #state{transport = TPid, dictionary = Dict} = S) -> + incr_error(recv, ReqPkt), + #diameter_packet{header = H, transport_data = TD} = ReqPkt, @@ -654,18 +662,18 @@ send_answer(Type, ReqPkt, #state{transport = TPid, dictionary = Dict} = S) -> %% An answer message clears the R and T flags and retains the P %% flag. The E flag is set at encode. - Pkt0 = #diameter_packet{header - = H#diameter_header{version = ?DIAMETER_VERSION, - is_request = false, - is_error = undefined, - is_retransmitted = false}, - msg = Msg, - transport_data = TD}, - - Pkt = diameter_codec:encode(Dict, Pkt0), - - incr_A(send, Pkt, Dict), - send(TPid, Pkt), + Pkt = #diameter_packet{header + = H#diameter_header{version = ?DIAMETER_VERSION, + is_request = false, + is_error = undefined, + is_retransmitted = false}, + msg = Msg, + transport_data = TD}, + + AnsPkt = diameter_codec:encode(Dict, Pkt), + + incr_rc(send, AnsPkt, Dict), + send(TPid, AnsPkt), eval(PostF, S). eval([F|A], S) -> @@ -874,7 +882,7 @@ handle_CEA(#diameter_packet{bin = Bin} = DPkt = diameter_codec:decode(Dict0, Pkt), - RC = result_code(incr_A(recv, DPkt, Dict0)), + RC = result_code(incr_rc(recv, DPkt, Dict0)), {SApps, IS, RCaps} = recv_CEA(DPkt, S), |