From 1c445024d76fde9557921be679c840d7f06bef8b Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 18 Aug 2024 09:24:34 +0200 Subject: [PATCH] Only request hostname once --- server/hostname.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/hostname.cpp b/server/hostname.cpp index af149458..88dc4c2b 100644 --- a/server/hostname.cpp +++ b/server/hostname.cpp @@ -11,7 +11,7 @@ #include #endif -std::string hostname() +static std::string _hostname() { #ifdef WIVRN_USE_GLIB GError * error = NULL; @@ -100,3 +100,10 @@ std::string hostname() U_LOG_W("Failed to get hostname"); return "no-hostname"; } + +std::string hostname() +{ + // Accessing hostname in child process fails with glib + static std::string result = _hostname(); + return result; +}