aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_util.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-06-10 05:51:34 +0200
committerAnders Svensson <[email protected]>2017-06-12 15:36:36 +0200
commit04cb786904558d9e9c64ccbb91cc15c49129e336 (patch)
tree0b2993a5fc0b999d5124ba13b47f0803d231edab /lib/diameter/test/diameter_util.erl
parentff367b200930d5107666e0a059d09e3218740567 (diff)
downloadotp-04cb786904558d9e9c64ccbb91cc15c49129e336.tar.gz
otp-04cb786904558d9e9c64ccbb91cc15c49129e336.tar.bz2
otp-04cb786904558d9e9c64ccbb91cc15c49129e336.zip
Exercise diameter_{tcp,sctp} sender in traffic suite
Diffstat (limited to 'lib/diameter/test/diameter_util.erl')
-rw-r--r--lib/diameter/test/diameter_util.erl19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl
index 8df5c907d0..81b43913de 100644
--- a/lib/diameter/test/diameter_util.erl
+++ b/lib/diameter/test/diameter_util.erl
@@ -309,17 +309,23 @@ listen(SvcName, Prot, Opts) ->
connect(Client, Prot, LRef) ->
connect(Client, Prot, LRef, []).
-connect(Client, Prot, LRef, Opts) ->
+connect(Client, ProtOpts, LRef, Opts) ->
+ Prot = head(ProtOpts),
[PortNr] = lport(Prot, LRef),
Client = diameter:service_info(Client, name), %% assert
true = diameter:subscribe(Client),
- Ref = add_transport(Client, {connect, opts(Prot, PortNr) ++ Opts}),
+ Ref = add_transport(Client, {connect, opts(ProtOpts, PortNr) ++ Opts}),
true = transport(Client, Ref), %% assert
diameter_lib:for_n(fun(_) -> ok = up(Client, Ref, Prot, PortNr) end,
proplists:get_value(pool_size, Opts, 1)),
Ref.
+head([T|_]) ->
+ T;
+head(T) ->
+ T.
+
up(Client, Ref, Prot, PortNr) ->
receive
{diameter_event, Client, {up, Ref, _, _, _}} -> ok
@@ -362,11 +368,14 @@ tmod(sctp) ->
tmod(any) ->
[diameter_sctp, diameter_tcp].
-opts(Prot, T) ->
- tmo(T, lists:append([[{transport_module, M}, {transport_config, C}]
+opts([Prot | Opts], T) ->
+ tmo(T, lists:append([[{transport_module, M}, {transport_config, C ++ Opts}]
|| M <- tmod(Prot),
C <- [buf(M,T) ++ [{ip, addr(M)}, {port, 0}]
- ++ remote(M,T)]])).
+ ++ remote(M,T)]]));
+
+opts(Prot, T) ->
+ opts([Prot], T).
tmo(listen, Opts) ->
Opts;