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 { guard let socket = socket else {
return false return false
} }
do { socket.close().whenFailure { [weak self] error in
try socket.close().wait() print("Failed to close socket for player: \(self?.name ?? "<Released>"): \(error)")
} catch {
print("Failed to close socket for player: \(name): \(error)")
} }
self.socket = nil self.socket = nil
return true return true