From f2534f8cb5dc74c75dd95598e7cbb445cb6c50c2 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Fri, 19 Aug 2022 20:05:05 -0700
Subject: [PATCH] Master server: use I_OutputMsg during startup

CONS_Printf calls CON_Drawer during startup, thread
collision stuff.
---
 src/http-mserv.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/http-mserv.c b/src/http-mserv.c
index 919acf330..cb08a85bc 100644
--- a/src/http-mserv.c
+++ b/src/http-mserv.c
@@ -21,6 +21,7 @@ Documentation available here.
 #include "doomdef.h"
 #include "d_clisrv.h"
 #include "command.h"
+#include "console.h"
 #include "m_argv.h"
 #include "m_menu.h"
 #include "mserv.h"
@@ -78,6 +79,19 @@ Contact_error (void)
 	);
 }
 
+static void
+Printf_url (const char *url)
+{
+	boolean startup;
+
+	I_lock_mutex(&con_mutex);
+	startup = con_startup;
+	I_unlock_mutex(con_mutex);
+
+	(startup ? I_OutputMsg : CONS_Printf)(
+			"HMS: connecting '%s'...\n", url);
+}
+
 static size_t
 HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
 {
@@ -177,7 +191,7 @@ HMS_connect (const char *format, ...)
 	if (quack_token)
 		sprintf(&url[seek], "&token=%s", quack_token);
 
-	CONS_Printf("HMS: connecting '%s'...\n", url);
+	Printf_url(url);
 
 	buffer = malloc(sizeof *buffer);
 	buffer->curl = curl;
-- 
GitLab