diff options
author | Anders Svensson <anders@erlang.org> | 2020-06-30 17:37:44 +0200 |
---|---|---|
committer | Anders Svensson <anders@erlang.org> | 2022-03-17 10:50:57 +0100 |
commit | 418b80e5afa6fa0293217aa3cd36dde701550069 (patch) | |
tree | 623f815ca606011af52f20bef1190e073eab728d /lib/diameter/src/transport/diameter_tcp.erl | |
parent | 815f50e2cf700ac283d151e02be23bf6cc23d0be (diff) | |
download | erlang-418b80e5afa6fa0293217aa3cd36dde701550069.tar.gz |
Remove is_port guard
Sockets in gen_tcp have always been ports, but assuming this is abusing
the interface since the type is documented as opaque. The assumption no
longer holds with the socket backend (eg. -kernel inet_backend socket),
so remove the is_port guard in the test functions
diameter_tcp:ports/0,1.
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 2c5dc2fa2e..ce4caea72b 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 |