mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-25 07:46:02 +00:00
Add fail check for deserialization error
This commit is contained in:
1 parent
a810a59b20
commit
99c57e9927
1 file changed
+14
-1
@@ -71,7 +71,20 @@ class InboundNearbyConnection: NearbyConnection{
|
|||||||
}catch{
|
}catch{
|
||||||
lastError = error
|
lastError = error
|
||||||
log("Deserialization error: \(error) in state \(currentState). Payload: \(frameData.hex)")
|
log("Deserialization error: \(error) in state \(currentState). Payload: \(frameData.hex)")
|
||||||
//protocolError()
|
|
||||||
|
let lastState = currentState
|
||||||
|
log("Waiting for 5 seconds to check if connection is still alive")
|
||||||
|
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
|
||||||
|
|
||||||
|
if self.currentState == lastState {
|
||||||
|
log("Still in state \(self.currentState), last state was \(lastState)")
|
||||||
|
self.protocolError()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log("State changed to \(self.currentState), not closing connection")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user