forked from Alamofire/Alamofire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Reachability Safety (Alamofire#3684)
### Issue Link 🔗 Alamofire#3676 ### Goals ⚽ This PR updates our integration of `SCNetworkReachabilityContext` to use a weak box class and fully integrate with the framework's retain and release closures. This follows the same logic as [Reachability.swift](https://github.com/ashleymills/Reachability.swift/blob/a81b7367f2c46875f29577e03a60c39cdfad0c8d/Sources/Reachability.swift#L190). ### Implementation Details 🚧 This PR adds a `WeakManager` type to wrap a weak reference to the `NetworkReachabilityManager` and updates the context memory management closures to properly retain and release the values. ### Testing Details 🔍 No tests added, wasn't able to find a way to trigger the reported crash. Since this logic matches that of the other popular reachability library I'm confident it's correct.
- Loading branch information
Showing
5 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters