diff options
author | Anders Svensson <[email protected]> | 2012-08-26 21:18:47 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2012-08-26 21:33:08 +0200 |
commit | aa62ff77cee327bedb42a8d43320c0c40c99f3d3 (patch) | |
tree | 6b492503228f7add49b1e9f7e56f965d48afb2d8 /lib | |
parent | 30412e11d96828a519e11c200393dafb898010bc (diff) | |
download | otp-aa62ff77cee327bedb42a8d43320c0c40c99f3d3.tar.gz otp-aa62ff77cee327bedb42a8d43320c0c40c99f3d3.tar.bz2 otp-aa62ff77cee327bedb42a8d43320c0c40c99f3d3.zip |
Minor spec and backwards compatibility fix
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diameter/src/base/diameter_peer.erl | 31 | ||||
-rw-r--r-- | lib/diameter/src/base/diameter_peer_fsm.erl | 7 |
2 files changed, 31 insertions, 7 deletions
diff --git a/lib/diameter/src/base/diameter_peer.erl b/lib/diameter/src/base/diameter_peer.erl index bfd59bee8e..a2a1c567d8 100644 --- a/lib/diameter/src/base/diameter_peer.erl +++ b/lib/diameter/src/base/diameter_peer.erl @@ -33,6 +33,9 @@ abort/1, notify/2]). +%% Old interface only called from old code. +-export([start/3]). %% < diameter-1.2 (R15B02) + %% Server start. -export([start_link/0]). @@ -70,9 +73,30 @@ notify(SvcName, T) -> rpc:abcast(nodes(), ?SERVER, {notify, SvcName, T}). %%% --------------------------------------------------------------------------- +%%% # start/3 +%%% --------------------------------------------------------------------------- + +%% From old code: make is restart. +start(_T, _Opts, #diameter_service{}) -> + {error, restart}. + +%%% --------------------------------------------------------------------------- %%% # start/1 %%% --------------------------------------------------------------------------- +-spec start({T, [Opt], #diameter_service{}}) + -> {TPid, [Addr], Tmo, Data} + | {error, [term()]} + when T :: {connect|accept, diameter:transport_ref()}, + Opt :: diameter:transport_opt(), + TPid :: pid(), + Addr :: inet:ip_address(), + Tmo :: non_neg_integer(), + Data :: {{T, Mod, Cfg}, [Mod], [{T, [Mod], Cfg}], [Err]}, + Mod :: module(), + Cfg :: term(), + Err :: term(). + %% Initial start. start({T, Opts, #diameter_service{} = Svc}) -> start(T, Svc, pair(Opts, [], []), []); @@ -132,13 +156,8 @@ def(Acc) -> start(T, Svc, [{Ms, Cfg, Tmo} | Rest], Errs) -> start(T, Ms, Cfg, Svc, Tmo, Rest, Errs); -%% One transport: return the bare error for backwards compatibility. -start(_, _, [], [Err]) -> - {Err}; - -%% Or not: return list of errors. start(_, _, [], Errs) -> - {{error, Errs}}. + {error, Errs}. %% start/7 diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl index d5e2d690cf..638d905195 100644 --- a/lib/diameter/src/base/diameter_peer_fsm.erl +++ b/lib/diameter/src/base/diameter_peer_fsm.erl @@ -121,6 +121,11 @@ %%% Output: Pid %%% --------------------------------------------------------------------------- +-spec start(T, [Opt], #diameter_service{}) + -> pid() + when T :: {connect|accept, diameter:transport_ref()}, + Opt :: diameter:transport_opt(). + %% diameter_config requires a non-empty list of applications on the %% service but diameter_service then constrains the list to any %% specified on the transport in question. Check here that the list is @@ -179,7 +184,7 @@ start_transport(Addrs0, T) -> erlang:monitor(process, TPid), q_next(TPid, Addrs0, Tmo, Data), {TPid, addrs(Addrs, Addrs0)}; - {No} -> + No -> exit({shutdown, No}) end. |