More detailed error messages if connection closed by peer or network connection was interrupted

This commit is contained in:
Leon Böttger committed 2025-07-25 11:07:45 +02:00
1 parent 8837d0e0aa
commit 24ce9dd677
20 files changed
+79 -2

No files matched your search

+7
View File
@@ -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
}