aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-06-21 11:38:38 +0200
committerAnders Svensson <[email protected]>2015-06-21 12:02:46 +0200
commitb409496fdb0eaa293a63f5c98c8f642aa8ce7aaa (patch)
treeea1ccf18deeb7ec7d0ff540fb0ed011abc75923c /lib/diameter
parentfc9e8a6bade31c7216a8d6a194ba221f6f15459c (diff)
downloadotp-b409496fdb0eaa293a63f5c98c8f642aa8ce7aaa.tar.gz
otp-b409496fdb0eaa293a63f5c98c8f642aa8ce7aaa.tar.bz2
otp-b409496fdb0eaa293a63f5c98c8f642aa8ce7aaa.zip
Fix connection timeouts in test transports
Without a timeout, TCP/SCTP connect can take some time to fail, which resulted in failures in the pool suite after the parent commit fixed the previously faulty sctp-first-then-tcp connect.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/test/diameter_util.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl
index c9022b9c53..5701ede0c1 100644
--- a/lib/diameter/test/diameter_util.erl
+++ b/lib/diameter/test/diameter_util.erl
@@ -380,9 +380,21 @@ tmod(any) ->
[diameter_sctp, diameter_tcp].
opts(Prot, T) ->
- lists:append([[{transport_module, M}, {transport_config, C}]
- || M <- tmod(Prot),
- C <- [cfg(M,T) ++ cfg(M) ++ cfg(T)]]).
+ tmo(T, lists:append([[{transport_module, M}, {transport_config, C}]
+ || M <- tmod(Prot),
+ C <- [cfg(M,T) ++ cfg(M) ++ cfg(T)]])).
+
+tmo(listen, Opts) ->
+ Opts;
+tmo(_, Opts) ->
+ tmo(Opts).
+
+%% Timeout on all but the last alternative.
+tmo([_,_] = Opts) ->
+ Opts;
+tmo([M, C | Opts]) ->
+ {transport_config = K, Cfg} = C,
+ [M, {K, Cfg, 5000} | tmo(Opts)].
%% Listening SCTP socket need larger-than-default buffers to avoid
%% resends on some platforms (eg. SLES 11).