Skip to content

Commit 3d33124

Browse files
committed
Remove use of accept_ack
Ranch no longer calls accept_ack for a transport, which means a couple important operations are missed for new sockets. Fixes #1835
1 parent 4563228 commit 3d33124

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/rabbit_networking.erl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
connection_info/1, connection_info/2,
3636
connection_info_all/0, connection_info_all/1,
3737
emit_connection_info_all/4, emit_connection_info_local/3,
38-
close_connection/2, accept_ack/2,
39-
handshake/2, tcp_host/1]).
38+
close_connection/2, handshake/2, tcp_host/1]).
4039

4140
%% Used by TCP-based transports, e.g. STOMP adapter
4241
-export([tcp_listener_addresses/1, tcp_listener_spec/9,
@@ -87,7 +86,6 @@
8786
-spec connection_info_all(rabbit_types:info_keys()) ->
8887
[rabbit_types:infos()].
8988
-spec close_connection(pid(), string()) -> 'ok'.
90-
-spec accept_ack(any(), rabbit_net:socket()) -> ok.
9189

9290
-spec on_node_down(node()) -> 'ok'.
9391
-spec tcp_listener_addresses(listener_config()) -> [address()].
@@ -363,16 +361,16 @@ handshake(Ref, ProxyProtocol) ->
363361
true ->
364362
{ok, ProxyInfo} = ranch:recv_proxy_header(Ref, 1000),
365363
{ok, Sock} = ranch:handshake(Ref),
366-
tune_buffer_size(Sock),
367-
ok = file_handle_cache:obtain(),
364+
setup_socket(Sock),
368365
{ok, {rabbit_proxy_socket, Sock, ProxyInfo}};
369366
false ->
370-
ranch:handshake(Ref)
367+
{ok, Sock} = ranch:handshake(Ref),
368+
setup_socket(Sock),
369+
{ok, Sock}
371370
end.
372371

373-
accept_ack(Ref, Sock) ->
374-
ok = ranch:accept_ack(Ref),
375-
tune_buffer_size(Sock),
372+
setup_socket(Sock) ->
373+
ok = tune_buffer_size(Sock),
376374
ok = file_handle_cache:obtain().
377375

378376
tune_buffer_size(Sock) ->

0 commit comments

Comments
 (0)