diff --git a/common/networking/connection.cpp b/common/networking/connection.cpp index a7638bc1d1..a5a3bb2992 100644 --- a/common/networking/connection.cpp +++ b/common/networking/connection.cpp @@ -50,7 +50,7 @@ static void default_conn_close_callback(struct connection *pconn) { fc_assert_msg(conn_close_callback != default_conn_close_callback, "Closing a socket (%s) before calling " - "close_socket_set_callback().", + "connections_set_close_callback().", conn_description(pconn)); } @@ -428,8 +428,12 @@ const char *conn_description(const struct connection *pconn, bool is_private) buffer[0] = '\0'; if (*pconn->username != '\0') { - fc_snprintf(buffer, sizeof(buffer), _("%s from %s"), pconn->username, - qUtf8Printable(addr)); + if (is_private) { + fc_snprintf(buffer, sizeof(buffer), _("%s from %s"), pconn->username, + qUtf8Printable(addr)); + } else { + fc_snprintf(buffer, sizeof(buffer), "%s", pconn->username); + } } else { sz_strlcpy(buffer, "server"); } diff --git a/server/connecthand.cpp b/server/connecthand.cpp index 8082edb3dd..72f4429412 100644 --- a/server/connecthand.cpp +++ b/server/connecthand.cpp @@ -477,16 +477,14 @@ bool handle_login_request(struct connection *pconn, */ void lost_connection_to_client(struct connection *pconn) { - const char *desc = conn_description(pconn); - fc_assert_ret(true == pconn->server.is_closing); - qInfo(_("Lost connection: %s."), desc); + qInfo(_("Lost connection: %s."), conn_description(pconn, true)); // Special color (white on black) for player loss notify_conn(game.est_connections, nullptr, E_CONNECTION, conn_controls_player(pconn) ? ftc_player_lost : ftc_server, - _("Lost connection: %s."), desc); + _("Lost connection: %s."), conn_description(pconn, false)); connection_detach(pconn, true); send_conn_info_remove(pconn->self, game.est_connections);