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

Added support for IPv6 to Reachability #3174

Merged
merged 3 commits into from Nov 23, 2015
Jump to file or symbol
Failed to load files and symbols.
+9 −9
Diff settings

Always

Just for now

@@ -100,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Creates and returns a network reachability manager for the socket address.
@param address The socket address (`sockaddr_in`) used to evaluate network reachability.
@param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
@return An initialized network reachability manager, actively monitoring the specified socket address.
*/
@@ -144,10 +144,17 @@ + (instancetype)managerForAddress:(const void *)address {
+ (instancetype)manager
{
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
struct sockaddr_in6 address;
bzero(&address, sizeof(address));
address.sin6_len = sizeof(address);
address.sin6_family = AF_INET6;
#else
struct sockaddr_in address;
bzero(&address, sizeof(address));
address.sin_len = sizeof(address);
address.sin_family = AF_INET;
#endif
return [self managerForAddress:&address];
}
@@ -36,14 +36,7 @@ - (void)setUp {
//both of these manager objects should always be reachable when the tests are run
self.domainReachability = [AFNetworkReachabilityManager managerForDomain:@"localhost"];
//don't use the shared manager because it retains state between tests
//but recreate it each time in the same way that the shared manager is created
struct sockaddr_in address;
bzero(&address, sizeof(address));
address.sin_len = sizeof(address);
address.sin_family = AF_INET;
self.addressReachability = [AFNetworkReachabilityManager managerForAddress:&address];
self.addressReachability = [AFNetworkReachabilityManager manager];
}
- (void)tearDown
ProTip! Use n and p to navigate between commits in a pull request.