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 #51

Merged
merged 1 commit into from
Feb 21, 2024

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
@AbhijeetMallick
Copy link
Collaborator

Looks good

@rcrahul43 rcrahul43 merged commit 68b1eea into rename_sdk Feb 21, 2024
1 check failed
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