diff options
author | Muxi Yan <mxyan@google.com> | 2017-02-08 11:31:26 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2017-02-08 15:26:32 -0800 |
commit | bf803b95638753230eb57bd4f3178b7d49ff2018 (patch) | |
tree | 6ef854032fb500a7d9f1edea7f4bea3abc241de3 /src | |
parent | a40ccd858085bfd5148e4e018b62d3f82430ebc6 (diff) |
Nit fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 0a10322367..1a8fc2e2ef 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -164,8 +164,8 @@ static NSMutableDictionary *callFlags; _requestHeaders = [[GRPCRequestHeaders alloc] initWithCall:self]; if ([requestWriter isKindOfClass:[GRXImmediateSingleWriter class]]) { - _unaryCall = true; - _unaryOpBatch = [[NSMutableArray alloc] init]; + _unaryCall = YES; + _unaryOpBatch = [NSMutableArray arrayWithCapacity:6]; } } return self; @@ -267,14 +267,13 @@ static NSMutableDictionary *callFlags; - (void)sendHeaders:(NSDictionary *)headers { // TODO(jcanizales): Add error handlers for async failures + GRPCOpSendMetadata *op = [[GRPCOpSendMetadata alloc] initWithMetadata:headers + flags:[GRPCCall callFlagsForHost:_host path:_path] + handler:nil]; if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[[[GRPCOpSendMetadata alloc] initWithMetadata:headers - flags:[GRPCCall callFlagsForHost:_host path:_path] - handler:nil]]]; + [_wrappedCall startBatchWithOperations:@[op]]; } else { - [_unaryOpBatch addObject:[[GRPCOpSendMetadata alloc] initWithMetadata:headers - flags:[GRPCCall callFlagsForHost:_host path:_path] - handler:nil]]; + [_unaryOpBatch addObject:op]; } } @@ -294,13 +293,14 @@ static NSMutableDictionary *callFlags; } } }; + + GRPCOpSendMessage *op = [[GRPCOpSendMessage alloc] initWithMessage:message + handler:resumingHandler]; if (!_unaryCall) { - [_wrappedCall startBatchWithOperations:@[[[GRPCOpSendMessage alloc] initWithMessage:message - handler:resumingHandler]] + [_wrappedCall startBatchWithOperations:@[op] errorHandler:errorHandler]; } else { - [_unaryOpBatch addObject:[[GRPCOpSendMessage alloc] initWithMessage:message - handler:resumingHandler]]; + [_unaryOpBatch addObject:op]; } } |