mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 05:46:03 +00:00
Remove logging for malformed protobuf, remove hint about deleting partial received file errors, firewall alert opening only for specific error code
This commit is contained in:
1 parent
0115a6453e
commit
cbcbb20077
2 files changed
+14
-20
No files matched your search
@@ -33,11 +33,8 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
override func handleConnectionClosure() {
|
override func handleConnectionClosure() {
|
||||||
super.handleConnectionClosure()
|
super.handleConnectionClosure()
|
||||||
currentState = .disconnected
|
currentState = .disconnected
|
||||||
do {
|
deletePartiallyReceivedFiles()
|
||||||
try deletePartiallyReceivedFiles()
|
|
||||||
} catch {
|
|
||||||
log("Error deleting partially received files: \(error)")
|
|
||||||
}
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
||||||
|
|
||||||
@@ -80,17 +77,7 @@ 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).")
|
||||||
|
|
||||||
// log("Public Key: \(publicKey?.pem ?? "nil")")
|
|
||||||
// log("Private Key: \(privateKey?.pem ?? "nil")")
|
|
||||||
// log("Ukey Client Init Msg: \(ukeyClientInitMsgData?.hex ?? "nil")")
|
|
||||||
// log("Ukey Server Init Msg: \(ukeyServerInitMsgData?.hex ?? "nil")")
|
|
||||||
log("S1: \(decryptKey?.map { String(format: "%02x", $0) }.joined() ?? "nil")")
|
|
||||||
// log("Encrypt Key: \(encryptKey?.map { String(format: "%02x", $0) }.joined() ?? "nil")")
|
|
||||||
log("Received HMAC/Signature Key: \(recvHmacKey?.withUnsafeBytes { Data(Array($0)) }.map { String(format: "%02x", $0) }.joined() ?? "nil")")
|
|
||||||
log("Sent HMAC/Signature Key: \(sendHmacKey?.withUnsafeBytes { Data(Array($0)) }.map { String(format: "%02x", $0) }.joined() ?? "nil")")
|
|
||||||
|
|
||||||
protocolError()
|
protocolError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,10 +422,15 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func deletePartiallyReceivedFiles() throws {
|
private func deletePartiallyReceivedFiles() {
|
||||||
for (_, file) in transferredFiles {
|
for (_, file) in transferredFiles {
|
||||||
guard file.created else { continue }
|
guard file.created else { continue }
|
||||||
try FileManager.default.removeItem(at: file.destinationURL)
|
do {
|
||||||
|
try FileManager.default.removeItem(at: file.destinationURL)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// if it fails, we don't care. Could be because file was not created yet
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,10 @@ class NearbyConnection {
|
|||||||
self.lastError = err
|
self.lastError = err
|
||||||
log("Error opening socket: \(err)")
|
log("Error opening socket: \(err)")
|
||||||
|
|
||||||
ConnectionFailureTracker.shared.recordFailure {
|
if err == .posix(.ENOTCONN) {
|
||||||
NearbyConnectionManager.shared.mainAppDelegate?.showFirewallAlert()
|
ConnectionFailureTracker.shared.recordFailure {
|
||||||
|
NearbyConnectionManager.shared.mainAppDelegate?.showFirewallAlert()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.handleConnectionClosure()
|
self.handleConnectionClosure()
|
||||||
|
|||||||
Reference in new issue
Block a user