aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_config.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2012-10-10 10:59:08 +0200
committerAnders Svensson <[email protected]>2012-11-05 11:54:30 +0100
commit0b7c87dc62d845d059d250ba152f16e94c660e55 (patch)
tree84e7f32c851cca24ad39b5b875d284e2794cee3d /lib/diameter/src/base/diameter_config.erl
parentf3ea0395506e7e80f9efb53d8c96c28bd288a066 (diff)
downloadotp-0b7c87dc62d845d059d250ba152f16e94c660e55.tar.gz
otp-0b7c87dc62d845d059d250ba152f16e94c660e55.tar.bz2
otp-0b7c87dc62d845d059d250ba152f16e94c660e55.zip
Implement service_opt() restrict_connections
Diffstat (limited to 'lib/diameter/src/base/diameter_config.erl')
-rw-r--r--lib/diameter/src/base/diameter_config.erl25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl
index fc37ca8541..63d28f25a2 100644
--- a/lib/diameter/src/base/diameter_config.erl
+++ b/lib/diameter/src/base/diameter_config.erl
@@ -555,7 +555,8 @@ make_config(SvcName, Opts) ->
Os = split(Opts, fun opt/2, [{false, share_peers},
{false, use_shared_peers},
{false, monitor},
- {?NOMASK, sequence}]),
+ {?NOMASK, sequence},
+ {nodes, restrict_connections}]),
%% share_peers and use_shared_peers are currently undocumented.
#service{name = SvcName,
@@ -579,15 +580,33 @@ opt(monitor, P)
when is_pid(P) ->
P;
+opt(restrict_connections, T)
+ when T == node;
+ T == nodes;
+ T == [];
+ is_atom(hd(T)) ->
+ T;
+
+opt(restrict_connections = K, F) ->
+ try diameter_lib:eval(F) of %% no guarantee that it won't fail later
+ Nodes when is_list(Nodes) ->
+ F;
+ V ->
+ ?THROW({value, {K,V}})
+ catch
+ E:R ->
+ ?THROW({value, {K, E, R, ?STACK}})
+ end;
+
opt(sequence, {_,_} = T) ->
sequence(T);
-opt(sequence, F) ->
+opt(sequence = K, F) ->
try diameter_lib:eval(F) of
T -> sequence(T)
catch
E:R ->
- ?THROW({value, {sequence, E, R, ?STACK}})
+ ?THROW({value, {K, E, R, ?STACK}})
end;
opt(K, _) ->