Skip to content

completely rejigger the way resuming works on smb

Harald Sitter requested to merge work/smb-shouldresume into master

the resuming logic is super duplicating and was also somewhat divergent between the duplicates.

to resolve this there's now a new unified couple of helpers that specifically deal with establishing context on a file transfer. this actually maybe should eventually move to KIO proper. it seems to me that every implementation needs to do more or less the same thing except for the IO specifics

  • shouldResume is called relatively early on and establishes the context. the context is entirely dependent on the resume configuration at hand. if KIO::Resume is set we resume in-place, otherwise we may have an intermediate .part file. if neither is applicable then we straight up need to overwrite. this effectively hides the details of the intermediate url switch. the actual transfer logic in smb_dir gets a context back with the destination configured to where it should write to (not necessarily where the file will end up at in the end)
  • concludeResumeHasError is called once the transfer is complete and concludes a potential resume by moving the .part file in place, or discarding it if the transfer aborted

to facilitate this there are some very lightweight IO abstraction classes in play now, encapsulating the IO concerns of the two functions so we can use them for both remote destinations or local destinations (we do need to do some stating and moving when dealing with part files specifically)

this now also gives us a much more isolated way of testing the resume logic specifically so I've also added a new unit test accordingly

this should also allow us to correctly implement resuming in smbCopy (currently ignores resume - which is inconsistent with how this would work if we didn't implement smb->smb and let KIO orchestrate two instances of smb.so to implement the transfer), and ::put which suffers much the same problem

Merge request reports

Loading