mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-22 06:15:59 +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
+67
-73
No files matched your search
@@ -33,11 +33,8 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
override func handleConnectionClosure() {
|
||||
super.handleConnectionClosure()
|
||||
currentState = .disconnected
|
||||
do {
|
||||
try deletePartiallyReceivedFiles()
|
||||
} catch {
|
||||
log("Error deleting partially received files: \(error)")
|
||||
}
|
||||
deletePartiallyReceivedFiles()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
||||
|
||||
@@ -80,17 +77,7 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
}
|
||||
} catch {
|
||||
lastError = error
|
||||
log("Deserialization error: \(error) in state \(currentState). Payload: \(frameData.hex)")
|
||||
|
||||
// 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")")
|
||||
|
||||
log("Deserialization error: \(error) in state \(currentState).")
|
||||
protocolError()
|
||||
}
|
||||
}
|
||||
@@ -435,10 +422,15 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
}
|
||||
}
|
||||
|
||||
private func deletePartiallyReceivedFiles() throws {
|
||||
private func deletePartiallyReceivedFiles() {
|
||||
for (_, file) in transferredFiles {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user