Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Data race condition in Network Reachability #50

Closed
wants to merge 1 commit into from

Conversation

rcrahul43
Copy link
Contributor

establishConnection() in RetryMechanism.swift internally checks for networkAvailability with Reachability which updates network status flags and triggers notifications in async.
observerNetworkConnectivity() adds observers for reachable and not-reachable state.
This sequence of events leads to race-condition for whenReachable and whenUnreachable observers as those are being set and get at the same time from different threads.

This MR changes sequence of events. With these changes, we add the observers first and then check for network status and try to establishConnection.

@rcrahul43 rcrahul43 self-assigned this Feb 8, 2024
@rcrahul43 rcrahul43 changed the base branch from main to rename_sdk February 8, 2024 08:26
@rcrahul43 rcrahul43 changed the base branch from rename_sdk to main February 8, 2024 08:34
@rcrahul43 rcrahul43 closed this Feb 8, 2024
@rcrahul43
Copy link
Contributor Author

branch created from main instead of rename_sdk

@rcrahul43 rcrahul43 deleted the fix/data_race_condition_reachability branch February 8, 2024 08:35
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.

1 participant