diff options
author | 2015-08-01 02:51:22 -0700 | |
---|---|---|
committer | 2015-08-01 18:02:28 -0700 | |
commit | bd993df3f6eeaea7b032b272703c5fc41beeebef (patch) | |
tree | 9899a6c2911487bbba902228ff52765fa0cedf52 /src/objective-c/GRPCClient/private/GRPCWrappedCall.m | |
parent | 3a5253eb129fa712f6962d0b8dc2b680b4e616c3 (diff) |
Encapsulate grpc_call creation inside GRPCChannel
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCWrappedCall.m')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 4681994bb2..db062336aa 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -39,7 +39,6 @@ #include <grpc/support/alloc.h> #import "GRPCChannel.h" -#import "GRPCCompletionQueue.h" #import "NSDictionary+GRPC.h" #import "NSData+GRPC.h" #import "NSError+GRPC.h" @@ -227,7 +226,6 @@ @implementation GRPCWrappedCall{ GRPCChannel *_channel; grpc_call *_call; - GRPCCompletionQueue *_queue; } - (instancetype)init { @@ -240,26 +238,15 @@ [NSException raise:NSInvalidArgumentException format:@"path and host cannot be nil."]; } - + if (self = [super init]) { static dispatch_once_t initialization; dispatch_once(&initialization, ^{ grpc_init(); }); - - _queue = [GRPCCompletionQueue completionQueue]; - if (!_queue) { - return nil; - } + _channel = [GRPCChannel channelToHost:host]; - if (!_channel) { - return nil; - } - _call = grpc_channel_create_call(_channel.unmanagedChannel, - _queue.unmanagedQueue, - path.UTF8String, - host.UTF8String, - gpr_inf_future(GPR_CLOCK_REALTIME)); + _call = [_channel unmanagedCallWithPath:path]; if (_call == NULL) { return nil; } @@ -308,4 +295,4 @@ grpc_call_destroy(_call); } -@end
\ No newline at end of file +@end |