aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_codec.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diameter/src/base/diameter_codec.erl')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index ac74a1b9c1..90683e7329 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -703,20 +703,23 @@ pack_avp(#diameter_avp{code = undefined, data = B})
Len = size(<<H:5/binary, _:24, T/binary>> = <<B/binary, 0:Pad>>),
<<H/binary, Len:24, T/binary>>;
-%% ... when ignoring errors in Failed-AVP ...
-%% ... during a relay encode ...
-pack_avp(#diameter_avp{data = <<0:1, B/binary>>} = A) ->
- pack_data(B, A);
-
-%% ... or as an iolist.
pack_avp(#diameter_avp{data = Data} = A) ->
- pack_data(Data, A).
+ pack_bits(Data, A).
header_length(<<_:32, 1:1, _/bitstring>>) ->
12;
header_length(_) ->
8.
+%% pack_bits/2
+
+%% Ignoring errors in Failed-AVP or during a relay encode.
+pack_bits(<<0:1, B/binary>>, Avp) ->
+ pack_bits(B, Avp);
+
+pack_bits(Data, Avp) ->
+ pack_data(Data, Avp).
+
%% pack_data/2
pack_data(Data, #diameter_avp{code = Code,