address comment

pull/17936/head
Muxi Yan 6 years ago
parent ac5e05cc29
commit 8855c07c9f
  1. 10
      src/objective-c/GRPCClient/GRPCCall.m
  2. 7
      src/objective-c/GRPCClient/GRPCCallOptions.h

@ -401,6 +401,7 @@ const char *kCFStreamVarName = "grpc_cfstream";
}
- (void)receiveNextMessages:(NSUInteger)numberOfMessages {
// branching based on _callOptions.enableFlowControl is handled inside _call
GRPCCall *copiedCall = nil;
@synchronized(self) {
copiedCall = _call;
@ -716,8 +717,13 @@ const char *kCFStreamVarName = "grpc_cfstream";
@synchronized(strongSelf) {
[strongSelf->_responseWriteable enqueueValue:data
completionHandler:^{
strongSelf->_pendingCoreRead = NO;
[strongSelf maybeStartNextRead];
__strong GRPCCall *strongSelf = weakSelf;
if (strongSelf) {
@synchronized (strongSelf) {
strongSelf->_pendingCoreRead = NO;
[strongSelf maybeStartNextRead];
}
}
}];
}
}

@ -243,8 +243,13 @@ typedef NS_ENUM(NSUInteger, GRPCTransportType) {
/**
* Enable flow control of a gRPC call. The option is default to NO. If set to YES, writeData: method
* should only be called at most once before a didWriteData callback is issued, and
* receiveNextMessage: must be called each time before gRPC call issues a didReceiveMessage
* receiveNextMessage: must be called each time before gRPC call can issues a didReceiveMessage
* callback.
*
* If writeData: method is called more than once before issuance of a didWriteData callback, gRPC
* will continue to queue the message and write them to gRPC core in order. However, the user
* assumes their own responsibility of flow control by keeping tracking of the pending writes in
* the call.
*/
@property(readwrite) BOOL enableFlowControl;

Loading…
Cancel
Save