diff --git a/deps/rabbit/src/rabbit_reader.erl b/deps/rabbit/src/rabbit_reader.erl index 42e7e70a75fe..58514ad2ca5e 100644 --- a/deps/rabbit/src/rabbit_reader.erl +++ b/deps/rabbit/src/rabbit_reader.erl @@ -1252,7 +1252,6 @@ handle_method0(#'connection.open'{virtual_host = VHost}, ok = rabbit_access_control:check_vhost_access(User, VHost, {socket, Sock}, #{}), ok = is_vhost_alive(VHost, User), NewConnection = Connection#connection{vhost = VHost}, - ok = send_on_channel0(Sock, #'connection.open_ok'{}, Protocol), Alarms = rabbit_alarm:register(self(), {?MODULE, conserve_resources, []}), BlockedBy = sets:from_list([{resource, Alarm} || Alarm <- Alarms]), @@ -1276,6 +1275,9 @@ handle_method0(#'connection.open'{virtual_host = VHost}, rabbit_log_connection:info( "connection ~ts: user '~ts' authenticated and granted access to vhost '~ts'", [dynamic_connection_name(ConnName), Username, VHost]), + + ok = send_on_channel0(Sock, #'connection.open_ok'{}, Protocol), + State1; handle_method0(#'connection.close'{}, State) when ?IS_RUNNING(State) -> lists:foreach(fun rabbit_channel:shutdown/1, all_channels()),