Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion RLBotCS/Conversion/FlatToCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion RLBotCS/Server/FlatBuffersServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private async Task HandleIncomingMessages()
}
}

private async Task HandleServer()
private async Task HandleServer()
{
try
{
Expand All @@ -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}");
Expand Down