diff options
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCHost.h | 5 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCHost.m | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index d9916d9303..291b07df37 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -38,6 +38,11 @@ struct grpc_channel_credentials; @property(nonatomic) int keepaliveInterval; @property(nonatomic) int keepaliveTimeout; @property(nonatomic) id logContext; +@property(nonatomic) BOOL retryEnabled; + +@property(nonatomic) unsigned int minConnectTimeout; +@property(nonatomic) unsigned int initialConnectBackoff; +@property(nonatomic) unsigned int maxConnectBackoff; /** The following properties should only be modified for testing: */ diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 348989904a..2e9f9f243b 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -85,6 +85,7 @@ static NSMutableDictionary *kHostCache; _secure = YES; kHostCache[address] = self; _compressAlgorithm = GRPC_COMPRESS_NONE; + _retryEnabled = YES; } #ifndef GRPC_CFSTREAM [GRPCConnectivityMonitor registerObserver:self selector:@selector(connectivityChange:)]; @@ -240,6 +241,20 @@ static NSMutableDictionary *kHostCache; args[@GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER] = [NSNumber numberWithInt:1]; } + if (_retryEnabled == NO) { + args[@GRPC_ARG_ENABLE_RETRIES] = [NSNumber numberWithInt:0]; + } + + if (_minConnectTimeout > 0) { + args[@GRPC_ARG_MIN_RECONNECT_BACKOFF_MS] = [NSNumber numberWithInt:_minConnectTimeout]; + } + if (_initialConnectBackoff > 0) { + args[@GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS] = [NSNumber numberWithInt:_initialConnectBackoff]; + } + if (_maxConnectBackoff > 0) { + args[@GRPC_ARG_MAX_RECONNECT_BACKOFF_MS] = [NSNumber numberWithInt:_maxConnectBackoff]; + } + return args; } |