aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-03-07 18:26:42 -0800
committerGravatar Muxi Yan <mxyan@google.com>2017-03-07 18:26:42 -0800
commit016d1085fc950023f232c4a8f93723fd591c6baa (patch)
tree1d12ab44a42df307aae35ae6e82d982a8a1d9f09 /src
parent43730581800577cf0e02b66677fe73841bdbecfe (diff)
Eliminate magic number 6
Diffstat (limited to 'src')
-rw-r--r--src/objective-c/GRPCClient/GRPCCall.m7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m
index 1a8fc2e2ef..1cda827e78 100644
--- a/src/objective-c/GRPCClient/GRPCCall.m
+++ b/src/objective-c/GRPCClient/GRPCCall.m
@@ -46,6 +46,11 @@
#import "private/NSDictionary+GRPC.h"
#import "private/NSError+GRPC.h"
+// At most 6 ops can be in an op batch for a client: SEND_INITIAL_METADATA,
+// SEND_MESSAGE, SEND_CLOSE_FROM_CLIENT, RECV_INITIAL_METADATA, RECV_MESSAGE,
+// and RECV_STATUS_ON_CLIENT.
+NSInteger kMaxClientBatch = 6;
+
NSString * const kGRPCHeadersKey = @"io.grpc.HeadersKey";
NSString * const kGRPCTrailersKey = @"io.grpc.TrailersKey";
static NSMutableDictionary *callFlags;
@@ -165,7 +170,7 @@ static NSMutableDictionary *callFlags;
if ([requestWriter isKindOfClass:[GRXImmediateSingleWriter class]]) {
_unaryCall = YES;
- _unaryOpBatch = [NSMutableArray arrayWithCapacity:6];
+ _unaryOpBatch = [NSMutableArray arrayWithCapacity:kMaxClientBatch];
}
}
return self;