aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-07-31 23:48:56 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2015-08-01 18:02:25 -0700
commit3a5253eb129fa712f6962d0b8dc2b680b4e616c3 (patch)
tree43d62830b8d750c1f34e1e1787c93166b3a8e1f1 /src/objective-c/GRPCClient/private
parentfaf58b84b5076ed4e20d825b2961d9313cd45649 (diff)
Move _channel from GRPCCall into GRPCWrappedCall
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.h7
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m23
2 files changed, 20 insertions, 10 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
index 18f8bb5531..da11cbb761 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
@@ -81,11 +81,12 @@
@end
+#pragma mark GRPCWrappedCall
+
@interface GRPCWrappedCall : NSObject
-- (instancetype)initWithChannel:(GRPCChannel *)channel
- path:(NSString *)path
- host:(NSString *)host NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithHost:(NSString *)host
+ path:(NSString *)path NS_DESIGNATED_INITIALIZER;
- (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler;
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index 1db63df77f..4681994bb2 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -32,10 +32,13 @@
*/
#import "GRPCWrappedCall.h"
+
#import <Foundation/Foundation.h>
#include <grpc/grpc.h>
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
+
+#import "GRPCChannel.h"
#import "GRPCCompletionQueue.h"
#import "NSDictionary+GRPC.h"
#import "NSData+GRPC.h"
@@ -219,21 +222,23 @@
@end
+#pragma mark GRPCWrappedCall
+
@implementation GRPCWrappedCall{
+ GRPCChannel *_channel;
grpc_call *_call;
GRPCCompletionQueue *_queue;
}
- (instancetype)init {
- return [self initWithChannel:nil path:nil host:nil];
+ return [self initWithHost:nil path:nil];
}
-- (instancetype)initWithChannel:(GRPCChannel *)channel
- path:(NSString *)path
- host:(NSString *)host {
- if (!channel || !path || !host) {
+- (instancetype)initWithHost:(NSString *)host
+ path:(NSString *)path {
+ if (!path || !host) {
[NSException raise:NSInvalidArgumentException
- format:@"channel, method, and host cannot be nil."];
+ format:@"path and host cannot be nil."];
}
if (self = [super init]) {
@@ -246,7 +251,11 @@
if (!_queue) {
return nil;
}
- _call = grpc_channel_create_call(channel.unmanagedChannel,
+ _channel = [GRPCChannel channelToHost:host];
+ if (!_channel) {
+ return nil;
+ }
+ _call = grpc_channel_create_call(_channel.unmanagedChannel,
_queue.unmanagedQueue,
path.UTF8String,
host.UTF8String,