Skip to content

🐛 Fixed an issue where after a device applies for a new IP address, it is not synchronized to other devices#2715

Merged
guiyanakuang merged 2 commits intomainfrom
2714-fixed-an-issue-where-after-a-device-applies-for-a-new-ip-address-it-is-not-synchronized-to-other-devices
May 9, 2025
Merged

🐛 Fixed an issue where after a device applies for a new IP address, it is not synchronized to other devices#2715
guiyanakuang merged 2 commits intomainfrom
2714-fixed-an-issue-where-after-a-device-applies-for-a-new-ip-address-it-is-not-synchronized-to-other-devices

Conversation

@guiyanakuang
Copy link
Copy Markdown
Member

close #2714

@guiyanakuang guiyanakuang added this to the CrossPaste 1.2.0 milestone May 9, 2025
@guiyanakuang guiyanakuang self-assigned this May 9, 2025
@guiyanakuang guiyanakuang requested a review from Copilot May 9, 2025 12:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a synchronization bug where a device’s newly applied IP address wasn't properly propagated to other devices. Key changes include updating API calls from update to updateSyncRuntimeInfo, converting several methods to suspend functions, and modifying the refresh behavior in the GeneralNearbyDeviceManager.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

File Description
DesktopCrossPasteModule.kt Updated instantiation of GeneralNearbyDeviceManager to remove an extraneous dependency
DeviceDetailContentView.kt Revised calls to use updateSyncRuntimeInfo instead of update
SyncHandler.kt & MarketingSyncHandler.kt Renamed update methods to updateSyncRuntimeInfo for consistency
MarketingNearbyDeviceManager.kt & GeneralNearbyDeviceManager.kt Changed device management methods (add, remove, refresh) to suspend functions and adjusted refresh logic
Comments suppressed due to low confidence (3)

app/src/commonMain/kotlin/com/crosspaste/sync/GeneralSyncHandler.kt:204

  • [nitpick] The private 'update' function called here shares a similar name to the public 'updateSyncRuntimeInfo' and might be confusing. Consider renaming the private helper (e.g., to 'performUpdate') to better differentiate its purpose.
return mutex.withLock { update { doUpdate(it) } }

app/src/commonMain/kotlin/com/crosspaste/sync/GeneralNearbyDeviceManager.kt:64

  • [nitpick] The revised refresh logic iterates over syncRuntimeInfos and calls updateSyncRuntimeInfo individually; consider whether a batched update might reduce overhead when processing many devices.
for (syncRuntimeInfo in existSyncRuntimeInfos) { ... }

app/src/desktopMain/kotlin/com/crosspaste/DesktopCrossPasteModule.kt:303

  • Ensure that the removal of the extra dependency is intentional and that the new constructor signature of GeneralNearbyDeviceManager fully supports all required functionality.
GeneralNearbyDeviceManager(get(), get(), get(), get())

@guiyanakuang guiyanakuang merged commit 4f248d4 into main May 9, 2025
2 checks passed
@guiyanakuang guiyanakuang deleted the 2714-fixed-an-issue-where-after-a-device-applies-for-a-new-ip-address-it-is-not-synchronized-to-other-devices branch July 12, 2025 12:28
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.

Fixed an issue where after a device applies for a new IP address, it is not synchronized to other devices.

2 participants