aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/include/diameter_gen.hrl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-02-15 14:40:41 +0100
committerAnders Svensson <[email protected]>2015-02-17 00:56:17 +0100
commit60ddb0dc9e5c1e28aa01548b01310744fd9ede15 (patch)
treeb94fef5960d27326697c2ff4b8ed3eed518ee16b /lib/diameter/include/diameter_gen.hrl
parentaf87b1c3d4897840d8247589a88d3611106ecedc (diff)
downloadotp-60ddb0dc9e5c1e28aa01548b01310744fd9ede15.tar.gz
otp-60ddb0dc9e5c1e28aa01548b01310744fd9ede15.tar.bz2
otp-60ddb0dc9e5c1e28aa01548b01310744fd9ede15.zip
Fix process dictionary manipulation during message decode
Decode can span multiple codec modules, so written entries cannot be tagged on ?MODULE.
Diffstat (limited to 'lib/diameter/include/diameter_gen.hrl')
-rw-r--r--lib/diameter/include/diameter_gen.hrl18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl
index bc25f7d472..49287b3f70 100644
--- a/lib/diameter/include/diameter_gen.hrl
+++ b/lib/diameter/include/diameter_gen.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -25,6 +25,9 @@
-define(THROW(T), throw({?MODULE, T})).
+%% Tag common to generated dictionaries.
+-define(TAG, diameter_gen).
+
%% Key to a value in the process dictionary that determines whether or
%% not an unrecognized AVP setting the M-bit should be regarded as an
%% error or not. See is_strict/0.
@@ -48,13 +51,20 @@
%% dictionary.
putr(K,V) ->
- put({?MODULE, K}, V).
+ put({?TAG, K}, V).
getr(K) ->
- get({?MODULE, K}).
+ case get({?TAG, K}) of
+ undefined ->
+ V = erase({?MODULE, K}), %% written in old code
+ V == undefined orelse putr(K,V),
+ V;
+ V ->
+ V
+ end.
eraser(K) ->
- erase({?MODULE, K}).
+ erase({?TAG, K}).
%% ---------------------------------------------------------------------------
%% # encode_avps/2