address comments

pull/18852/head
Muxi Yan 6 years ago
parent 2cb1892c77
commit eb62ad3fae
  1. 2
      src/objective-c/GRPCClient/GRPCInterceptor.h
  2. 10
      src/objective-c/GRPCClient/GRPCInterceptor.m

@ -74,7 +74,7 @@
* receiveNextMessages * receiveNextMessages
* didReceiveInitialMetadata * didReceiveInitialMetadata
* didReceiveData * didReceiveData
* didWriteData * didWriteData receiveNextmessages
* writeData ----- ----- ---- didReceiveInitialMetadata * writeData ----- ----- ---- didReceiveInitialMetadata
* receiveNextMessages | | | | | | didReceiveData * receiveNextMessages | | | | | | didReceiveData
* | V | V | V didWriteData * | V | V | V didWriteData

@ -44,40 +44,50 @@
- (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions - (void)startNextInterceptorWithRequest:(GRPCRequestOptions *)requestOptions
callOptions:(GRPCCallOptions *)callOptions { callOptions:(GRPCCallOptions *)callOptions {
if (_nextInterceptor != nil) {
id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor; id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor;
dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{
[copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions]; [copiedNextInterceptor startWithRequestOptions:requestOptions callOptions:callOptions];
}); });
} }
}
- (void)writeNextInterceptorWithData:(id)data { - (void)writeNextInterceptorWithData:(id)data {
if (_nextInterceptor != nil) {
id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor; id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor;
dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{
[copiedNextInterceptor writeData:data]; [copiedNextInterceptor writeData:data];
}); });
} }
}
- (void)finishNextInterceptor { - (void)finishNextInterceptor {
if (_nextInterceptor != nil) {
id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor; id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor;
dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{
[copiedNextInterceptor finish]; [copiedNextInterceptor finish];
}); });
} }
}
- (void)cancelNextInterceptor { - (void)cancelNextInterceptor {
if (_nextInterceptor != nil) {
id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor; id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor;
dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{
[copiedNextInterceptor cancel]; [copiedNextInterceptor cancel];
}); });
} }
}
/** Notify the next interceptor in the chain to receive more messages */ /** Notify the next interceptor in the chain to receive more messages */
- (void)receiveNextInterceptorMessages:(NSUInteger)numberOfMessages { - (void)receiveNextInterceptorMessages:(NSUInteger)numberOfMessages {
if (_nextInterceptor != nil) {
id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor; id<GRPCInterceptorInterface> copiedNextInterceptor = _nextInterceptor;
dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{ dispatch_async(copiedNextInterceptor.requestDispatchQueue, ^{
[copiedNextInterceptor receiveNextMessages:numberOfMessages]; [copiedNextInterceptor receiveNextMessages:numberOfMessages];
}); });
} }
}
// Methods to forward GRPCResponseHandler callbacks to the previous object // Methods to forward GRPCResponseHandler callbacks to the previous object

Loading…
Cancel
Save