|
|
@ -130,13 +130,7 @@ static void PassFlagsToContextInfoBlock(SCNetworkReachabilityRef target, |
|
|
|
if ((self = [super init])) { |
|
|
|
if ((self = [super init])) { |
|
|
|
_reachabilityRef = CFRetain(reachability); |
|
|
|
_reachabilityRef = CFRetain(reachability); |
|
|
|
_queue = dispatch_get_main_queue(); |
|
|
|
_queue = dispatch_get_main_queue(); |
|
|
|
SCNetworkReachabilityFlags flags; |
|
|
|
_previousReachabilityFlags = nil; |
|
|
|
if (SCNetworkReachabilityGetFlags(_reachabilityRef, &flags)) { |
|
|
|
|
|
|
|
_previousReachabilityFlags = |
|
|
|
|
|
|
|
[[GRPCReachabilityFlags alloc] initWithFlags:flags]; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
_previousReachabilityFlags = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return self; |
|
|
|
return self; |
|
|
|
} |
|
|
|
} |
|
|
@ -162,7 +156,8 @@ static void PassFlagsToContextInfoBlock(SCNetworkReachabilityRef target, |
|
|
|
[self startListeningWithHandler:^(GRPCReachabilityFlags *flags) { |
|
|
|
[self startListeningWithHandler:^(GRPCReachabilityFlags *flags) { |
|
|
|
if (!flags.reachable) { |
|
|
|
if (!flags.reachable) { |
|
|
|
handler(); |
|
|
|
handler(); |
|
|
|
} else if (flags.isWWAN ^ _previousReachabilityFlags.isWWAN) { |
|
|
|
} else if (!_previousReachabilityFlags || |
|
|
|
|
|
|
|
(flags.isWWAN ^ _previousReachabilityFlags.isWAAN)) { |
|
|
|
wifiStatusChangeHandler(); |
|
|
|
wifiStatusChangeHandler(); |
|
|
|
} |
|
|
|
} |
|
|
|
_previousReachabilityFlags = flags; |
|
|
|
_previousReachabilityFlags = flags; |
|
|
|