From 9cc0b2afe9b3a87d3fa73639cca61a29e3a8cea5 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 9 Aug 2020 21:35:54 +0700 Subject: [PATCH] Add ability to clean broken connections for getter `GetActiveConnections()` by default returns all connections currently recorded in `ConnectionService`, which might include broken player connections, if player disconnected recently and it still was not properly handled. Optional parameter was added to clean connections before returning them, which might cause a change in state of `ConnectionService`. --- sources/Services/Connection/ConnectionService.uc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sources/Services/Connection/ConnectionService.uc b/sources/Services/Connection/ConnectionService.uc index 2514350..1018ee6 100644 --- a/sources/Services/Connection/ConnectionService.uc +++ b/sources/Services/Connection/ConnectionService.uc @@ -146,8 +146,12 @@ public final function bool RegisterConnection(PlayerController player) return true; } -public final function array GetActiveConnections() +public final function array GetActiveConnections( + optional bool removeBroken) { + if (removeBroken) { + RemoveBrokenConnections(); + } return activeConnections; }