From de976bab1affb2ecb09b738d7dcd43b7a7f7f45e Mon Sep 17 00:00:00 2001 From: Moose! Date: Sun, 17 May 2026 14:08:15 -0500 Subject: [PATCH 1/3] Warn about possibly invalid map names --- RLBotCS/Conversion/FlatToCommand.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/RLBotCS/Conversion/FlatToCommand.cs b/RLBotCS/Conversion/FlatToCommand.cs index 83d9936..ed8739c 100644 --- a/RLBotCS/Conversion/FlatToCommand.cs +++ b/RLBotCS/Conversion/FlatToCommand.cs @@ -404,9 +404,23 @@ public static (string, CustomMap?) MakeOpenCommand(MatchConfigurationT matchConf customMap = new(matchConfig.GameMapUpk); command += CustomMap.RL_MAP_KEY; } - else + else { - command += matchConfig.GameMapUpk; + // Warn if the map name doesn't look like a valid official or custom map. + // Official maps end with _p or _P, custom maps end with .upk or .udk. + string mapUpk = matchConfig.GameMapUpk; + bool isOfficialMap = mapUpk.EndsWith("_p", StringComparison.OrdinalIgnoreCase); + bool isCustomMapExtension = + mapUpk.EndsWith(".upk", StringComparison.OrdinalIgnoreCase) + || mapUpk.EndsWith(".udk", StringComparison.OrdinalIgnoreCase); + if (!isOfficialMap && !isCustomMapExtension) + { + Logger.LogWarning( + $"Map name '{mapUpk}' does not end with '_p'/'_P' (official maps) or '.upk'/'.udk' (custom maps). " + + "The map may fail to load. Official map names should end with '_p', e.g. 'Stadium_P'." + ); + } + command += mapUpk; } } else From ba6c22e9cfb4cf2f921560e955f17179e908c492 Mon Sep 17 00:00:00 2001 From: Moose! Date: Sun, 17 May 2026 14:19:43 -0500 Subject: [PATCH 2/3] Improve error messages when IO fails --- RLBotCS/Server/FlatBuffersServer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/RLBotCS/Server/FlatBuffersServer.cs b/RLBotCS/Server/FlatBuffersServer.cs index b58fa42..4fa84f9 100644 --- a/RLBotCS/Server/FlatBuffersServer.cs +++ b/RLBotCS/Server/FlatBuffersServer.cs @@ -84,7 +84,7 @@ private async Task HandleIncomingMessages() } } - private async Task HandleServer() + private async Task HandleServer() { try { @@ -105,6 +105,18 @@ private async Task HandleServer() } } } + catch (SocketException e) when (e.SocketErrorCode == SocketError.AddressAlreadyInUse) + { + _context.Logger.LogError( + $"Port {rlbotPort} is already in use. Is another instance of RLBot already running?" + ); + } + catch (SocketException e) when (e.SocketErrorCode == SocketError.OperationAborted) + { + // This happens during normal shutdown when the server is stopped while waiting + // for a connection. Not an error. + _context.Logger.LogDebug("Server stopped while waiting for connections."); + } catch (Exception e) { _context.Logger.LogError($"Error while handling server: {e}"); From d69469b29d09adb532b441aac29f064d39337de4 Mon Sep 17 00:00:00 2001 From: Moose! Date: Sun, 17 May 2026 14:32:25 -0500 Subject: [PATCH 3/3] Update FlatToCommand.cs --- RLBotCS/Conversion/FlatToCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RLBotCS/Conversion/FlatToCommand.cs b/RLBotCS/Conversion/FlatToCommand.cs index ed8739c..ce9e191 100644 --- a/RLBotCS/Conversion/FlatToCommand.cs +++ b/RLBotCS/Conversion/FlatToCommand.cs @@ -404,7 +404,7 @@ public static (string, CustomMap?) MakeOpenCommand(MatchConfigurationT matchConf customMap = new(matchConfig.GameMapUpk); command += CustomMap.RL_MAP_KEY; } - else + else { // Warn if the map name doesn't look like a valid official or custom map. // Official maps end with _p or _P, custom maps end with .upk or .udk.