aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-09-22 19:52:47 +0200
committerAnders Svensson <[email protected]>2011-09-26 15:49:04 +0200
commit73f89318887d473536350b1531cad27f9ab94c7c (patch)
treeed35be82a6ccc72c9d49167271144086c76ba305 /lib/diameter
parent97f3a064f27843a9f825210c1c7a27075b7b3ad7 (diff)
downloadotp-73f89318887d473536350b1531cad27f9ab94c7c.tar.gz
otp-73f89318887d473536350b1531cad27f9ab94c7c.tar.bz2
otp-73f89318887d473536350b1531cad27f9ab94c7c.zip
Fix header folding bug
A prepare_request callback from diameter can return a diameter_header record with in order to set values in the header of an outgoing request. The fault in diameter_lib:fold_tuple/3 caused encode of the outgoing request to fail.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/src/app/diameter_lib.erl15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/diameter/src/app/diameter_lib.erl b/lib/diameter/src/app/diameter_lib.erl
index b5c0e1bf6a..46fd87c591 100644
--- a/lib/diameter/src/app/diameter_lib.erl
+++ b/lib/diameter/src/app/diameter_lib.erl
@@ -255,12 +255,13 @@ w(L) ->
fold_tuple(_, T, undefined) ->
T;
-fold_tuple(N, T0, T) ->
- element(2, lists:foldl(fun(X, {M,_} = A) -> {M+1, ft(X, A)} end,
- {N, T0},
- lists:nthtail(N-1, tuple_to_list(T)))).
+fold_tuple(N, T0, T1) ->
+ {_, T} = lists:foldl(fun(V, {I,_} = IT) -> {I+1, ft(V, IT)} end,
+ {N, T0},
+ lists:nthtail(N-1, tuple_to_list(T1))),
+ T.
-ft(undefined, T) ->
+ft(undefined, {_, T}) ->
T;
-ft(X, {N, T}) ->
- setelement(N, T, X).
+ft(Value, {Idx, T}) ->
+ setelement(Idx, T, Value).