mirror of https://github.com/grpc/grpc.git
parent
2e8e7e4838
commit
d6c98bf82e
9 changed files with 108 additions and 23 deletions
@ -0,0 +1,34 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2019 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#ifdef GRPC_COMPILE_WITH_CRONET |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/**
|
||||
* Enable Cronet for once. |
||||
*/ |
||||
void enableCronet(); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,38 @@ |
||||
/* |
||||
* |
||||
* Copyright 2019 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#ifdef GRPC_COMPILE_WITH_CRONET |
||||
|
||||
#import <Cronet/Cronet.h> |
||||
#import "EnableCronet.h" |
||||
|
||||
void enableCronet(void) { |
||||
static dispatch_once_t enableCronet; |
||||
dispatch_once(&enableCronet, ^{ |
||||
[Cronet setHttp2Enabled:YES]; |
||||
[Cronet setSslKeyLogFileName:@"Documents/key"]; |
||||
[Cronet enableTestCertVerifierForTesting]; |
||||
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory |
||||
inDomains:NSUserDomainMask] lastObject]; |
||||
NSLog(@"Documents directory: %@", url); |
||||
[Cronet start]; |
||||
[Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; |
||||
}); |
||||
} |
||||
|
||||
#endif |
Loading…
Reference in new issue