From e249bc564ea61dc2f640434960edf5fe44e81f5d Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Tue, 5 Nov 2019 18:05:32 -0800 Subject: [PATCH] [AltServer] Fixes dropping connection before client receives response --- AltServer/Connections/ConnectionManager.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/AltServer/Connections/ConnectionManager.swift b/AltServer/Connections/ConnectionManager.swift index 055e873b..92f4219b 100644 --- a/AltServer/Connections/ConnectionManager.swift +++ b/AltServer/Connections/ConnectionManager.swift @@ -292,7 +292,10 @@ private extension ConnectionManager self.send(response, to: connection) { (result) in print("Sent response to \(connection.endpoint) with result:", result) - self.disconnect(connection) + // Add short delay to prevent us from dropping connection too quickly. + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + self.disconnect(connection) + } } }