mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 21:06:10 +00:00
More detailed error messages if connection closed by peer or network connection was interrupted
This commit is contained in:
1 parent
8837d0e0aa
commit
24ce9dd677
20 files changed
+79
-2
No files matched your search
@@ -52,6 +52,7 @@ class NearbyConnection {
|
||||
|
||||
func start() {
|
||||
connection.stateUpdateHandler = { state in
|
||||
|
||||
if !self.connectionClosed {
|
||||
if case .ready = state {
|
||||
self.connectionReady()
|
||||
@@ -91,6 +92,10 @@ class NearbyConnection {
|
||||
}
|
||||
}
|
||||
|
||||
if err == .posix(.ENETDOWN) {
|
||||
self.lastError = NearbyError.protocolError("Error.NetworkDown")
|
||||
}
|
||||
|
||||
self.handleConnectionClosure()
|
||||
}
|
||||
}
|
||||
@@ -133,6 +138,7 @@ class NearbyConnection {
|
||||
}
|
||||
if isComplete {
|
||||
log("Connection closed by peer during receiveFrameAsync")
|
||||
self.lastError = NearbyError.protocolError("Error.ClosedByPeer".localized())
|
||||
self.handleConnectionClosure()
|
||||
return
|
||||
}
|
||||
@@ -162,6 +168,7 @@ class NearbyConnection {
|
||||
}
|
||||
if isComplete {
|
||||
log("Connection closed by peer during receiveFrameAsync")
|
||||
self.lastError = NearbyError.protocolError("Error.ClosedByPeer".localized())
|
||||
self.handleConnectionClosure()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user