diff --git a/RLBotCS/Conversion/FlatToCommand.cs b/RLBotCS/Conversion/FlatToCommand.cs index 83d9936..ce9e191 100644 --- a/RLBotCS/Conversion/FlatToCommand.cs +++ b/RLBotCS/Conversion/FlatToCommand.cs @@ -406,7 +406,21 @@ public static (string, CustomMap?) MakeOpenCommand(MatchConfigurationT matchConf } 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 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}");