aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/examples/code/relay.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-03-21 19:10:19 +0100
committerAnders Svensson <[email protected]>2015-03-24 10:57:03 +0100
commit949cec3fdcf94310aa567921ac2ea37569beb970 (patch)
tree616dc008095a53094f8d5c56c9eab694a7915289 /lib/diameter/examples/code/relay.erl
parentd6de8b13a37bc454f6d5a425cdaff6a114b4168c (diff)
downloadotp-949cec3fdcf94310aa567921ac2ea37569beb970.tar.gz
otp-949cec3fdcf94310aa567921ac2ea37569beb970.tar.bz2
otp-949cec3fdcf94310aa567921ac2ea37569beb970.zip
Let examples override default service options
To make them a bit more flexible. Can now do things like this: server:start([{'Product-Name', "Bob"}]), server:listen({tcp, [{capx_timeout, 2000}]}) Beware that the latter is completely different from this: server:listen(tcp, [{capx_timeout, 2000}])
Diffstat (limited to 'lib/diameter/examples/code/relay.erl')
-rw-r--r--lib/diameter/examples/code/relay.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/diameter/examples/code/relay.erl b/lib/diameter/examples/code/relay.erl
index e50d1a33f0..7bc46dc68d 100644
--- a/lib/diameter/examples/code/relay.erl
+++ b/lib/diameter/examples/code/relay.erl
@@ -32,6 +32,7 @@
-module(relay).
-export([start/1,
+ start/2,
listen/2,
connect/2,
stop/1]).
@@ -58,11 +59,19 @@
start(Name)
when is_atom(Name) ->
- node:start(Name, ?SERVICE(Name)).
+ start(Name, []).
+
+%% start/1
start() ->
start(?DEF_SVC_NAME).
+%% start/2
+
+start(Name, Opts) ->
+ node:start(Name, Opts ++ [T || {K,_} = T <- ?SERVICE(Name),
+ false == lists:keymember(K, 1, Opts)]).
+
%% listen/2
listen(Name, T) ->