Skip to content

Conversation

@dajimenezriv-internxt
Copy link
Contributor

@dajimenezriv-internxt dajimenezriv-internxt commented Nov 4, 2025

What

Currently we were using two different contexts for fetch data and cancel fetch data, each one with its own mutex. However, the mutex of the cancel fetch data was just to printing a line when the cancel was finished.

Now, we are going to use the same context between both, so the flow is going to be as follow.

  1. The fetch data is going to be called when do double click on a file or right click and "Always keep on this device".
  2. We create a context with the callbackInfo that C++ provides us with the path, the connectionKey and the transferKey (the connectionKey is the same for all transfers). This context is created using CreateTransferContext from TransferContext.cpp.
  3. We call the fetchData function in javascript from C++ passing as props the path and a callback to send the chunks. Also, we set the mutex of the context to wait until the fetch data is completed or is cancelled.
  4. From javascript we get the read stream and we call the callback with each chunk.
  5. In C++ we transfer the chunk to the placeholder and show the progress in the UI.
  6. On finished we mark the placeholder as PINNED (AlwaysLocal) and we unlock the mutex.
  7. In case that it doesn't finish because we have cancelled from cancel fetch data, we just call the function cancelFetchData in javascript from C++ passsing as prop the path so we can stop the download in javascript. It also unlocks the mutex of the context.

@dajimenezriv-internxt dajimenezriv-internxt self-assigned this Nov 4, 2025
@dajimenezriv-internxt dajimenezriv-internxt changed the title Modify transfer context Modify cancel fetch data Nov 4, 2025
Base automatically changed from improve-connect-and-disconnect-sync-root to master November 4, 2025 17:18
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@dajimenezriv-internxt dajimenezriv-internxt merged commit 345bf92 into master Nov 5, 2025
3 of 4 checks passed
@dajimenezriv-internxt dajimenezriv-internxt deleted the modify-transfer-context branch November 5, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants