Skip to content
Snippets Groups Projects
Commit aed1de9d authored by Makarand Dharmapurikar's avatar Makarand Dharmapurikar
Browse files

Style guide related feedback fixes.

parent 6d2ed00a
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,16 @@
*/
@interface GRPCCall (Cronet)
+(void)useCronet:(cronet_engine *)cronet_engine;
/* This method should be called before issuing the first RPC. It should be
* called only once. Create an instance of Cronet engine in your app elsewhere
* and pass the instance pointer in the cronet_engine parameter. Once set,
* all subsequent RPCs will use Cronet transport. The method is not thread
* safe.
*/
+(void)useCronetWithEngine:(cronet_engine *)engine;
+(void *)getCronetEngine;
+(cronet_engine *)cronetEngine;
+(BOOL)isUsingCronet;
......
......@@ -33,22 +33,22 @@
#import "GRPCCall+Cronet.h"
static BOOL use_cronet = NO;
static void *g_cronet_engine;
static BOOL useCronet = NO;
static cronet_engine *globalCronetEngine;
@implementation GRPCCall (Cronet)
+ (void)useCronet:(cronet_engine *)cronet_engine {
use_cronet = YES;
g_cronet_engine = cronet_engine;
+ (void)useCronetWithEngine:(cronet_engine *)engine {
useCronet = YES;
globalCronetEngine = engine;
}
+ (void *)getCronetEngine {
return g_cronet_engine;
+ (cronet_engine *)cronetEngine {
return globalCronetEngine;
}
+ (BOOL)isUsingCronet {
return use_cronet;
return useCronet;
}
@end
......@@ -154,7 +154,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
+ (GRPCChannel *)secureCronetChannelWithHost:(NSString *)host
channelArgs:(NSDictionary *)channelArgs {
void *engine = [GRPCCall getCronetEngine];
cronet_engine *engine = [GRPCCall cronetEngine];
if (!engine) {
[NSException raise:NSInvalidArgumentException
format:@"cronet_engine is NULL. Set it first."];
......
......@@ -201,14 +201,14 @@ NS_ASSUME_NONNULL_BEGIN
- (GRPCChannel *)newChannel {
NSDictionary *args = [self channelArgs];
BOOL use_cronet = [GRPCCall isUsingCronet];
BOOL useCronet = [GRPCCall isUsingCronet];
if (_secure) {
GRPCChannel *channel;
@synchronized(self) {
if (_channelCreds == nil) {
[self setTLSPEMRootCerts:nil withPrivateKey:nil withCertChain:nil error:nil];
}
if (use_cronet) {
if (useCronet) {
channel = [GRPCChannel secureCronetChannelWithHost:_address
channelArgs:args];
} else {
......
......@@ -80,7 +80,7 @@
#pragma mark Tests
static cronet_engine *_engine = NULL;
static cronet_engine *cronetEngine = NULL;
@implementation InteropTests {
RMTTestService *_service;
......@@ -93,12 +93,12 @@ static cronet_engine *_engine = NULL;
- (void)setUp {
_service = self.class.host ? [RMTTestService serviceWithHost:self.class.host] : nil;
#ifdef GRPC_COMPILE_WITH_CRONET
if (_engine == NULL) {
if (cronetEngine == NULL) {
// Cronet setup
[Cronet setHttp2Enabled:YES];
[Cronet setSslKeyLogFileName:@"cronetkeylogfile.pem"];
[Cronet start];
_engine = [Cronet getGlobalEngine];
[GRPCCall useCronet:_engine];
cronetEngine = [Cronet getGlobalEngine];
[GRPCCall useCronetWithEngine:cronetEngine];
}
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment