diff --git a/src/network/network_config.hpp b/src/network/network_config.hpp index 9238d8cdb..d1c4933c9 100644 --- a/src/network/network_config.hpp +++ b/src/network/network_config.hpp @@ -59,7 +59,7 @@ private: /** The singleton instance. */ static NetworkConfig *m_network_config[PT_COUNT]; - enum NetworkType + enum NetworkType : int { NETWORK_NONE, NETWORK_WAN, NETWORK_LAN }; @@ -67,7 +67,7 @@ private: std::atomic m_ip_type; /** Keeps the type of network connection: none (yet), LAN or WAN. */ - NetworkType m_network_type; + std::atomic m_network_type; /** If set it allows clients to connect directly to this server without * using the stk server in between. It requires obviously that this @@ -75,7 +75,7 @@ private: bool m_is_public_server; /** True if this host is a server, false otherwise. */ - bool m_is_server; + std::atomic_bool m_is_server; /** True if a client should connect to the first server it finds and * immediately start a race. */ diff --git a/src/utils/log.cpp b/src/utils/log.cpp index f6f130c97..f50e1784c 100644 --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -173,16 +173,20 @@ void Log::printMessage(int level, const char *component, const char *format, remaining = MAX_LENGTH - index > 0 ? MAX_LENGTH - index : 0; } -#ifndef ANDROID +#ifdef MOBILE_STK + // Mobile STK already has timestamp logging in console + std::string server_prefix = "Server"; +#else + std::string server_prefix = StkTime::getLogTime(); +#endif if (NetworkConfig::get()->isNetworking() && NetworkConfig::get()->isServer()) { index += snprintf (line + index, remaining, - "%s [%s] %s: ", StkTime::getLogTime().c_str(), + "%s [%s] %s: ", server_prefix.c_str(), names[level], component); } else -#endif { index += snprintf (line + index, remaining, "[%s] %s: ", names[level], component);