File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -226,21 +226,22 @@ private final actor NFCConnectionManager: NSObject {
226
226
throw NFCConnectionError . unsupported
227
227
}
228
228
229
- // To proceed with a new connection we need to acquire a lock
230
- guard !isEstablishing else { throw ConnectionError . cancelled }
231
- defer { isEstablishing = false }
232
- isEstablishing = true
233
-
234
- // Close the previous connection before establishing a new one
229
+ // if there is already a connection for this slot we throw `ConnectionError.busy`.
230
+ // The caller must close the connection first.
235
231
switch currentState {
236
232
case . inactive:
237
233
// lets continue
238
234
break
239
235
case . scanning, . connected:
240
- // invalidate and continue
241
- await invalidate ( )
236
+ // throw
237
+ throw ConnectionError . busy
242
238
}
243
239
240
+ // To proceed with a new connection we need to acquire a lock
241
+ guard !isEstablishing else { throw ConnectionError . cancelled }
242
+ defer { isEstablishing = false }
243
+ isEstablishing = true
244
+
244
245
// Start polling
245
246
guard let session = NFCTagReaderSession ( pollingOption: [ . iso14443] , delegate: self , queue: nil ) else {
246
247
throw NFCConnectionError . failedToPoll
You can’t perform that action at this time.
0 commit comments