diff options
author | Anders Svensson <[email protected]> | 2013-04-12 15:32:21 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2013-04-12 15:32:21 +0200 |
commit | e5d08c54f6770aad54ada273cd45bc409fb41713 (patch) | |
tree | 6d416d35b7da554066caa87f2cb3bb012621f0d4 /lib/diameter/test/diameter_util.erl | |
parent | e09920ed1da9ebf3efa814d8f5039140109beab3 (diff) | |
parent | 4875b24b95b41ca716f0cf2f7881333035a35425 (diff) | |
download | otp-e5d08c54f6770aad54ada273cd45bc409fb41713.tar.gz otp-e5d08c54f6770aad54ada273cd45bc409fb41713.tar.bz2 otp-e5d08c54f6770aad54ada273cd45bc409fb41713.zip |
Merge branch 'anders/diameter/address_config/OTP-10986' into maint
* anders/diameter/address_config/OTP-10986:
Comment fix
More robust listening port lookup in test suites
Update example client to allow default local address
Make explicit local address to diameter_tcp:start/3 optional
Add transport interface 'connected' message with local address list
Diffstat (limited to 'lib/diameter/test/diameter_util.erl')
-rw-r--r-- | lib/diameter/test/diameter_util.erl | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index a9872f32e1..aa489fef5f 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. 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 @@ -33,7 +33,6 @@ %% diameter-specific -export([lport/2, - lport/3, listen/2, listen/3, connect/3, connect/4, disconnect/4, @@ -251,27 +250,17 @@ path(Config, Name) -> filename:join([Dir, Name]). %% --------------------------------------------------------------------------- -%% lport/2-3 +%% lport/2 %% %% Lookup the port number of a tcp/sctp listening transport. -lport(M, Ref) -> - lport(M, Ref, 1). +lport(M, {Node, Ref}) -> + rpc:call(Node, ?MODULE, lport, [M, Ref]); -lport(M, {Node, Ref}, Tries) -> - rpc:call(Node, ?MODULE, lport, [M, Ref, Tries]); - -lport(M, Ref, Tries) -> - lp(tmod(M), Ref, Tries). - -lp(M, Ref, T) -> - L = [N || {listen, N, _} <- M:ports(Ref)], - if [] /= L orelse T =< 1 -> - L; - true -> - receive after 50 -> ok end, - lp(M, Ref, T-1) - end. +lport(Prot, Ref) -> + Mod = tmod(Prot), + [_] = diameter_reg:wait({'_', listener, {Ref, '_'}}), + [N || {listen, N, _} <- Mod:ports(Ref)]. %% --------------------------------------------------------------------------- %% listen/2-3 @@ -297,7 +286,7 @@ connect(Client, Prot, LRef) -> connect(Client, Prot, LRef, []). connect(Client, Prot, LRef, Opts) -> - [PortNr] = lport(Prot, LRef, 20), + [PortNr] = lport(Prot, LRef), Client = diameter:service_info(Client, name), %% assert true = diameter:subscribe(Client), Ref = add_transport(Client, {connect, opts(Prot, PortNr) ++ Opts}), |