Add system to kick people if they connect to multiple servers at once. (#34563)

This commit is contained in:
Pieter-Jan Briers
2025-01-22 00:23:47 +01:00
committed by GitHub
parent 1031d2a6c1
commit 71c9dfc9ea
12 changed files with 242 additions and 27 deletions

View File

@@ -350,6 +350,15 @@ namespace Content.Server.Database
/// <param name="notification">The notification to trigger</param>
void InjectTestNotification(DatabaseNotification notification);
/// <summary>
/// Send a notification to all other servers connected to the same database.
/// </summary>
/// <remarks>
/// The local server will receive the sent notification itself again.
/// </remarks>
/// <param name="notification">The notification to send.</param>
Task SendNotification(DatabaseNotification notification);
#endregion
}
@@ -1045,6 +1054,12 @@ namespace Content.Server.Database
HandleDatabaseNotification(notification);
}
public Task SendNotification(DatabaseNotification notification)
{
DbWriteOpsMetric.Inc();
return RunDbCommand(() => _db.SendNotification(notification));
}
private async void HandleDatabaseNotification(DatabaseNotification notification)
{
lock (_notificationHandlers)