Skip to content

Commit d4598ed

Browse files
committed
Adapt to OTP28 sslsocket
1. OTP28 changed sslsocket structure 2. some old hacks should no longer be necessary
1 parent 1ded509 commit d4598ed

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

deps/rabbit_common/src/rabbit_net.erl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,10 @@
8282
-define(SSL_CLOSE_TIMEOUT, 5000).
8383

8484
-define(IS_SSL(Sock), is_tuple(Sock)
85-
andalso (tuple_size(Sock) =:= 3)
8685
andalso (element(1, Sock) =:= sslsocket)).
8786

8887
is_ssl(Sock) -> ?IS_SSL(Sock).
8988

90-
%% Seems hackish. Is hackish. But the structure is stable and
91-
%% kept this way for backward compatibility reasons. We need
92-
%% it for two reasons: there are no ssl:getstat(Sock) function,
93-
%% and no ssl:close(Timeout) function. Both of them are being
94-
%% worked on as we speak.
95-
ssl_get_socket(Sock) ->
96-
element(2, element(2, Sock)).
97-
9889
ssl_info(Sock) when ?IS_SSL(Sock) ->
9990
ssl:connection_information(Sock);
10091
ssl_info(_Sock) ->
@@ -119,12 +110,12 @@ controlling_process(Sock, Pid) when is_port(Sock) ->
119110
gen_tcp:controlling_process(Sock, Pid).
120111

121112
getstat(Sock, Stats) when ?IS_SSL(Sock) ->
122-
inet:getstat(ssl_get_socket(Sock), Stats);
113+
ssl:getstat(Sock, Stats);
123114
getstat(Sock, Stats) when is_port(Sock) ->
124115
inet:getstat(Sock, Stats);
125116
%% Used by Proxy protocol support in plugins
126117
getstat({rabbit_proxy_socket, Sock, _}, Stats) when ?IS_SSL(Sock) ->
127-
inet:getstat(ssl_get_socket(Sock), Stats);
118+
ssl:getstat(Sock, Stats);
128119
getstat({rabbit_proxy_socket, Sock, _}, Stats) when is_port(Sock) ->
129120
inet:getstat(Sock, Stats).
130121

@@ -197,7 +188,7 @@ fast_close(Sock) when ?IS_SSL(Sock) ->
197188
{'DOWN', MRef, process, Pid, _Reason} ->
198189
ok
199190
end,
200-
catch port_close(ssl_get_socket(Sock)),
191+
catch ssl:close(Sock),
201192
ok;
202193
fast_close(Sock) when is_port(Sock) ->
203194
catch port_close(Sock), ok.

0 commit comments

Comments
 (0)