rename kHostCache->gHostCache

pull/16190/head
Muxi Yan 6 years ago
parent d92c62fcde
commit 1084f49c31
  1. 18
      src/objective-c/GRPCClient/private/GRPCHost.m

@ -35,7 +35,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
static NSMutableDictionary *kHostCache; static NSMutableDictionary *gHostCache;
@implementation GRPCHost { @implementation GRPCHost {
NSString *_PEMRootCertificates; NSString *_PEMRootCertificates;
@ -65,10 +65,10 @@ static NSMutableDictionary *kHostCache;
// Look up the GRPCHost in the cache. // Look up the GRPCHost in the cache.
static dispatch_once_t cacheInitialization; static dispatch_once_t cacheInitialization;
dispatch_once(&cacheInitialization, ^{ dispatch_once(&cacheInitialization, ^{
kHostCache = [NSMutableDictionary dictionary]; gHostCache = [NSMutableDictionary dictionary];
}); });
@synchronized(kHostCache) { @synchronized(gHostCache) {
GRPCHost *cachedHost = kHostCache[address]; GRPCHost *cachedHost = gHostCache[address];
if (cachedHost) { if (cachedHost) {
return cachedHost; return cachedHost;
} }
@ -76,15 +76,15 @@ static NSMutableDictionary *kHostCache;
if ((self = [super init])) { if ((self = [super init])) {
_address = address; _address = address;
_retryEnabled = YES; _retryEnabled = YES;
kHostCache[address] = self; gHostCache[address] = self;
} }
} }
return self; return self;
} }
+ (void)resetAllHostSettings { + (void)resetAllHostSettings {
@synchronized(kHostCache) { @synchronized(gHostCache) {
kHostCache = [NSMutableDictionary dictionary]; gHostCache = [NSMutableDictionary dictionary];
} }
} }
@ -140,8 +140,8 @@ static NSMutableDictionary *kHostCache;
address = [hostURL.host stringByAppendingString:@":443"]; address = [hostURL.host stringByAppendingString:@":443"];
} }
__block GRPCHost *cachedHost; __block GRPCHost *cachedHost;
@synchronized (kHostCache) { @synchronized (gHostCache) {
cachedHost = kHostCache[address]; cachedHost = gHostCache[address];
} }
return (cachedHost != nil); return (cachedHost != nil);
} }

Loading…
Cancel
Save