Address the comments

pull/8441/head
Muxi Yan 8 years ago
parent 72e92441f7
commit 0a18d64fcc
  1. 11
      src/objective-c/GRPCClient/private/GRPCConnectivityMonitor.m
  2. 3
      src/objective-c/GRPCClient/private/GRPCHost.m
  3. 3
      src/objective-c/GRPCClient/private/GRPCReachabilityFlagNames.xmacro.h
  4. 1
      src/objective-c/tests/Connectivity/Podfile

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

@ -101,6 +101,9 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
_secure = YES;
kHostCache[address] = self;
// When there is host in the cache, keep a single monitor to the network
// to
// flush the cache if the connectivity status changed
if (!connectivityMonitor) {
connectivityMonitor =
[GRPCConnectivityMonitor monitorWithHost:hostURL.host];

@ -55,7 +55,7 @@
#endif
#if TARGET_OS_IPHONE
GRPC_XMACRO_ITEM(isCell, IsWWAN)
GRPC_XMACRO_ITEM(isWWAN, IsWWAN)
#endif
GRPC_XMACRO_ITEM(reachable, Reachable)
GRPC_XMACRO_ITEM(transientConnection, TransientConnection)
@ -65,4 +65,3 @@ GRPC_XMACRO_ITEM(interventionRequired, InterventionRequired)
GRPC_XMACRO_ITEM(connectionOnDemand, ConnectionOnDemand)
GRPC_XMACRO_ITEM(isLocalAddress, IsLocalAddress)
GRPC_XMACRO_ITEM(isDirect, IsDirect)
GRPC_XMACRO_ITEM(isWWAN, IsWWAN)

@ -8,6 +8,7 @@ target 'ConnectivityTestingApp' do
pod 'gRPC', :path => GRPC_LOCAL_SRC
pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC
pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf"
pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
end

Loading…
Cancel
Save