File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
shared/src/commonMain/kotlin/uk/co/sentinelweb/cuer/app/service/transfers Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -230,15 +230,27 @@ class MemoryTransfersService(
230
230
? : run {
231
231
queue
232
232
.find { it.id == id }
233
- ?.let {
233
+ ?.let { localQueueTransfer ->
234
234
// try to cancel remote
235
- it.takeIf { it.target?.node?.ipport() != localRepository.localNode.ipport() }
235
+ localQueueTransfer
236
+ .takeIf { it.target?.node?.ipport() != localRepository.localNode.ipport() }
236
237
?.also { log.d(" Cancel remote" ) }
237
- ?.let { cancelTransfersUsecase.execute(it) }
238
- ?.copy(status = Paused ) // ensure its in paused stated - otherwise repeating
239
- ?.also { addReplaceTransfer(it) }
240
-
241
- it.takeIf { it.target?.node?.ipport() == localRepository.localNode.ipport() }
238
+ ?.also {
239
+ // cancel remote item
240
+ cancelTransfersUsecase.execute(it)
241
+ // ensure its in paused stated - otherwise repeating
242
+ ?.copy(status = Paused )
243
+ ?.also { addReplaceTransfer(it) }
244
+ // just replace the local queued item
245
+ // (if cancel remote items fails above (maybe item isn't there))
246
+ ? : localQueueTransfer
247
+ .copy(status = Paused )
248
+ .also { addReplaceTransfer(it) }
249
+ }
250
+
251
+ // if item has local target then set to pause - (maybe not in inProgressTransfers)
252
+ localQueueTransfer
253
+ .takeIf { it.target?.node?.ipport() == localRepository.localNode.ipport() }
242
254
?.copy(status = Paused )
243
255
?.also { addReplaceTransfer(it) }
244
256
}
You can’t perform that action at this time.
0 commit comments