diff --git a/src/global_distrib/mod_global_distrib_connection.erl b/src/global_distrib/mod_global_distrib_connection.erl index ec7ad70f37..1a8594d7ca 100644 --- a/src/global_distrib/mod_global_distrib_connection.erl +++ b/src/global_distrib/mod_global_distrib_connection.erl @@ -108,8 +108,14 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. terminate(Reason, State) -> - ?LOG_ERROR(#{what => gd_outgoing_socket_error, - reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}), + case Reason of + shutdown -> + ?LOG_INFO(#{what => gd_outgoing_socket_error, + reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}); + _ -> + ?LOG_ERROR(#{what => gd_outgoing_socket_error, + reason => Reason, peer => State#state.peer, conn_id => State#state.conn_id}) + end, mongoose_instrument:execute(?GLOBAL_DISTRIB_OUTGOING_CLOSED, #{}, #{count => 1, host => State#state.host}), catch mod_global_distrib_transport:close(State#state.socket), ignore. diff --git a/src/global_distrib/mod_global_distrib_receiver.erl b/src/global_distrib/mod_global_distrib_receiver.erl index 3cb4f89bfc..00300d00e0 100644 --- a/src/global_distrib/mod_global_distrib_receiver.erl +++ b/src/global_distrib/mod_global_distrib_receiver.erl @@ -135,9 +135,16 @@ code_change(_Version, State, _Extra) -> {ok, State}. terminate(Reason, State) -> - ?LOG_WARNING(#{what => gd_incoming_socket_closed, - peer => State#state.peer, server => State#state.host, - reason => Reason, conn_id => State#state.conn_id}), + case Reason of + normal -> + ?LOG_INFO(#{what => gd_incoming_socket_closed, + peer => State#state.peer, server => State#state.host, + reason => Reason, conn_id => State#state.conn_id}); + _ -> + ?LOG_WARNING(#{what => gd_incoming_socket_closed, + peer => State#state.peer, server => State#state.host, + reason => Reason, conn_id => State#state.conn_id}) + end, mongoose_instrument:execute(?GLOBAL_DISTRIB_INCOMING_CLOSED, #{}, #{count => 1, host => State#state.host}), catch mod_global_distrib_transport:close(State#state.socket),