diff options
author | Anders Svensson <anders@erlang.org> | 2022-03-17 11:23:43 +0100 |
---|---|---|
committer | Anders Svensson <anders@erlang.org> | 2022-03-17 11:23:43 +0100 |
commit | 4af6e94239e01f4faeffc2361dd550c4b35b334c (patch) | |
tree | 982ec8fa910bff7ac7e5ba26653f4a57579e2060 /lib/diameter/src/transport/diameter_tcp.erl | |
parent | 207449d43bcf67cd26390e8aba143328e0d71181 (diff) | |
parent | d42d0fe0a89d115caa596c229c1c758c4859ee44 (diff) | |
download | erlang-4af6e94239e01f4faeffc2361dd550c4b35b334c.tar.gz |
Merge branch 'anders/diameter/test/OTP-16752'
* anders/diameter/test/OTP-16752:
Rework remaining diameter testsuites
Rework diameter_{dist,distribution,examples}_SUITE
Rework diameter_{traffic,tls,transport}_SUITE
Simplify diameter_util
Run fewer testcases in diameter_traffic_SUITE
Remove is_port guard
Skip diameter_gen_sctp_SUITE
Diffstat (limited to 'lib/diameter/src/transport/diameter_tcp.erl')
-rw-r--r-- | lib/diameter/src/transport/diameter_tcp.erl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/diameter/src/transport/diameter_tcp.erl b/lib/diameter/src/transport/diameter_tcp.erl index 9ac9f2d59c..f40f2b1fc4 100644 --- a/lib/diameter/src/transport/diameter_tcp.erl +++ b/lib/diameter/src/transport/diameter_tcp.erl @@ -43,6 +43,7 @@ -export([listener/1,%% diameter_sync callback info/1]). %% service_info callback +%% test -export([ports/0, ports/1]). @@ -450,16 +451,20 @@ sock(_, Sock) -> resolve(Type, S) -> Sock = sock(Type, S), try - ok(portnr(Sock)) + {ok, T} = portnr(Sock), + T catch _:_ -> Sock end. -portnr(Sock) - when is_port(Sock) -> - portnr(gen_tcp, Sock); +%% Assume either ssl or gen_tcp. In particular, this can't deal with a +%% transport module that called start/3 with an own module option. portnr(Sock) -> - portnr(ssl, Sock). + try + {ok, _} = portnr(ssl, Sock) + catch + _:_ -> portnr(gen_tcp, Sock) + end. %% --------------------------------------------------------------------------- %% # handle_call/3 |