aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/app
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-05-20 12:32:34 +0200
committerAnders Svensson <[email protected]>2011-05-20 12:32:34 +0200
commitce1bb47f364c58822339fa4b05e823aa52b3d7cb (patch)
tree6bb6040549917a9a442c9d8959a6f108baf90f2c /lib/diameter/src/app
parent7715953ce12be54b1889ebf5af4ba694186370a8 (diff)
downloadotp-ce1bb47f364c58822339fa4b05e823aa52b3d7cb.tar.gz
otp-ce1bb47f364c58822339fa4b05e823aa52b3d7cb.tar.bz2
otp-ce1bb47f364c58822339fa4b05e823aa52b3d7cb.zip
Minor diameter_service fix when sending a diameter_header/avp list
plus an example fix.
Diffstat (limited to 'lib/diameter/src/app')
-rw-r--r--lib/diameter/src/app/.gitignore1
-rw-r--r--lib/diameter/src/app/diameter_service.erl16
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/diameter/src/app/.gitignore b/lib/diameter/src/app/.gitignore
index 1310a0da6b..d388e61877 100644
--- a/lib/diameter/src/app/.gitignore
+++ b/lib/diameter/src/app/.gitignore
@@ -2,4 +2,5 @@
/diameter_gen_*.erl
/diameter_gen_*.hrl
/depend.mk
+/diameter.mk
diff --git a/lib/diameter/src/app/diameter_service.erl b/lib/diameter/src/app/diameter_service.erl
index 82a8d7a994..63b0649dc4 100644
--- a/lib/diameter/src/app/diameter_service.erl
+++ b/lib/diameter/src/app/diameter_service.erl
@@ -1278,18 +1278,15 @@ send_request({TPid, Caps, App}, Msg, Opts, Caller, SvcName) ->
%% make_packet/1
%%
%% Turn an outgoing request as passed to call/4 into a diameter_packet
-%% record in preparation for a prepare_request callback. There are two
-%% cases: a diameter_packet as argument when we're calling call/4
-%% ourselves in order to relay a request or a bare message in case the
-%% call came by way of diameter:call/4.
+%% record in preparation for a prepare_request callback.
make_packet(Bin)
when is_binary(Bin) ->
#diameter_packet{header = diameter_codec:decode_header(Bin),
bin = Bin};
-make_packet(#diameter_packet{msg = [#diameter_header{} | _]} = Pkt) ->
- Pkt;
+make_packet(#diameter_packet{msg = [#diameter_header{} = Hdr | Avps]} = Pkt) ->
+ Pkt#diameter_packet{msg = [make_header(Hdr) | Avps]};
make_packet(#diameter_packet{header = Hdr} = Pkt) ->
Pkt#diameter_packet{header = make_header(Hdr)};
@@ -1955,6 +1952,7 @@ is_loop(Code, Vid, OH, Avps) ->
%%
%% Send a locally originating reply.
+%% No errors or a diameter_header/avp list.
reply(Msg, Dict, TPid, #diameter_packet{errors = Es,
transport_data = TD}
= ReqPkt)
@@ -1964,11 +1962,7 @@ reply(Msg, Dict, TPid, #diameter_packet{errors = Es,
incr(send, Pkt, Dict, TPid), %% count result codes in sent answers
send(TPid, Pkt#diameter_packet{transport_data = TD});
-%% Simplify the handling of error cases by accepting a list consisting
-%% of an answer record followed by failed AVPs to be packed into a
-%% Failed-AVP field, either directly or into an AVP field. Only if
-%% the message is a tuple-list or record however, not a list
-%% with a list of #diameter_header{} and #diameter_avp{}.
+%% Or not: set Result-Code and Failed-AVP AVP's.
reply(Msg, Dict, TPid, #diameter_packet{errors = [H|_] = Es} = Pkt) ->
reply(rc(Msg, rc(H), [A || {_,A} <- Es], Dict),
Dict,