mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 21:06:10 +00:00
Only call connectionWasTerminated if not rejected
This commit is contained in:
1 parent
2c4d661ef3
commit
4262c387a2
1 file changed
+10
-5
@@ -17,6 +17,7 @@ import SwiftECC
|
|||||||
|
|
||||||
class InboundNearbyConnection: NearbyConnection {
|
class InboundNearbyConnection: NearbyConnection {
|
||||||
private var currentState: State = .initial
|
private var currentState: State = .initial
|
||||||
|
private var wasRejected = false
|
||||||
public var delegate: InboundNearbyConnectionDelegate?
|
public var delegate: InboundNearbyConnectionDelegate?
|
||||||
private var cipherCommitment: Data?
|
private var cipherCommitment: Data?
|
||||||
|
|
||||||
@@ -35,11 +36,13 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
super.handleConnectionClosure()
|
super.handleConnectionClosure()
|
||||||
currentState = .disconnected
|
currentState = .disconnected
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
if !self.wasRejected {
|
||||||
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
DispatchQueue.main.async {
|
||||||
|
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
||||||
SaveFilesManager.shared.movePendingFilesToTarget()
|
|
||||||
SaveFilesManager.shared.stopAccessingSecurityScopedResource()
|
SaveFilesManager.shared.movePendingFilesToTarget()
|
||||||
|
SaveFilesManager.shared.stopAccessingSecurityScopedResource()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,6 +463,8 @@ class InboundNearbyConnection: NearbyConnection {
|
|||||||
|
|
||||||
private func rejectTransfer(with reason: Sharing_Nearby_ConnectionResponseFrame.Status = .reject) {
|
private func rejectTransfer(with reason: Sharing_Nearby_ConnectionResponseFrame.Status = .reject) {
|
||||||
|
|
||||||
|
self.wasRejected = true
|
||||||
|
|
||||||
log("Rejecting transfer because of \( reason)")
|
log("Rejecting transfer because of \( reason)")
|
||||||
|
|
||||||
var frame = Sharing_Nearby_Frame()
|
var frame = Sharing_Nearby_Frame()
|
||||||
|
|||||||
Reference in new issue
Block a user