diff options
-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. |