mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +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 {
|
||||
private var currentState: State = .initial
|
||||
private var wasRejected = false
|
||||
public var delegate: InboundNearbyConnectionDelegate?
|
||||
private var cipherCommitment: Data?
|
||||
|
||||
@@ -35,11 +36,13 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
super.handleConnectionClosure()
|
||||
currentState = .disconnected
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
||||
|
||||
SaveFilesManager.shared.movePendingFilesToTarget()
|
||||
SaveFilesManager.shared.stopAccessingSecurityScopedResource()
|
||||
if !self.wasRejected {
|
||||
DispatchQueue.main.async {
|
||||
self.delegate?.connectionWasTerminated(connection: self, error: self.lastError)
|
||||
|
||||
SaveFilesManager.shared.movePendingFilesToTarget()
|
||||
SaveFilesManager.shared.stopAccessingSecurityScopedResource()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,6 +463,8 @@ class InboundNearbyConnection: NearbyConnection {
|
||||
|
||||
private func rejectTransfer(with reason: Sharing_Nearby_ConnectionResponseFrame.Status = .reject) {
|
||||
|
||||
self.wasRejected = true
|
||||
|
||||
log("Rejecting transfer because of \( reason)")
|
||||
|
||||
var frame = Sharing_Nearby_Frame()
|
||||
|
||||
Reference in new issue
Block a user