Fix crash when closing socket

This commit is contained in:
Christoph Hagen 2021-12-21 14:53:47 +01:00
parent 8329b9c8b5
commit 19aa91eff2

View File

@ -71,10 +71,8 @@ extension Player {
guard let socket = socket else {
return false
}
do {
try socket.close().wait()
} catch {
print("Failed to close socket for player: \(name): \(error)")
socket.close().whenFailure { [weak self] error in
print("Failed to close socket for player: \(self?.name ?? "<Released>"): \(error)")
}
self.socket = nil
return true