address comments

pull/18852/head
Muxi Yan 6 years ago
parent 7ec6669481
commit 2cb1892c77
  1. 2
      src/objective-c/GRPCClient/GRPCCall.m
  2. 2
      src/objective-c/GRPCClient/GRPCInterceptor.h
  3. 4
      src/objective-c/GRPCClient/GRPCInterceptor.m
  4. 29
      src/objective-c/examples/InterceptorSample/InterceptorSample/CacheInterceptor.m
  5. 110
      src/objective-c/tests/InteropTests.m

@ -68,8 +68,6 @@ const char *kCFStreamVarName = "grpc_cfstream";
callOptions:(GRPCCallOptions *)callOptions callOptions:(GRPCCallOptions *)callOptions
writeDone:(void (^)(void))writeDone; writeDone:(void (^)(void))writeDone;
- (void)receiveNextMessages:(NSUInteger)numberOfMessages;
@end @end
@implementation GRPCRequestOptions @implementation GRPCRequestOptions

@ -210,7 +210,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata; - (void)forwardPreviousInterceptorWithInitialMetadata:(nullable NSDictionary *)initialMetadata;
/** Forward a received message to the previous interceptor in the chain */ /** Forward a received message to the previous interceptor in the chain */
- (void)forwardPreviousIntercetporWithData:(nullable id)data; - (void)forwardPreviousInterceptorWithData:(nullable id)data;
/** Forward call close and trailing metadata to the previous interceptor in the chain */ /** Forward call close and trailing metadata to the previous interceptor in the chain */
- (void)forwardPreviousInterceptorCloseWithTrailingMetadata: - (void)forwardPreviousInterceptorCloseWithTrailingMetadata:

@ -92,7 +92,7 @@
} }
/** Forward a received message to the previous interceptor in the chain */ /** Forward a received message to the previous interceptor in the chain */
- (void)forwardPreviousIntercetporWithData:(id)data { - (void)forwardPreviousInterceptorWithData:(id)data {
if ([_previousInterceptor respondsToSelector:@selector(didReceiveData:)]) { if ([_previousInterceptor respondsToSelector:@selector(didReceiveData:)]) {
id<GRPCResponseHandler> copiedPreviousInterceptor = _previousInterceptor; id<GRPCResponseHandler> copiedPreviousInterceptor = _previousInterceptor;
dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{ dispatch_async(copiedPreviousInterceptor.dispatchQueue, ^{
@ -194,7 +194,7 @@
} }
- (void)didReceiveData:(id)data { - (void)didReceiveData:(id)data {
[_manager forwardPreviousIntercetporWithData:data]; [_manager forwardPreviousInterceptorWithData:data];
} }
- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error {

@ -167,7 +167,8 @@
dispatch_queue_t _dispatchQueue; dispatch_queue_t _dispatchQueue;
BOOL _cacheable; BOOL _cacheable;
BOOL _messageSeen; BOOL _writeMessageSeen;
BOOL _readMessageSeen;
GRPCCallOptions *_callOptions; GRPCCallOptions *_callOptions;
GRPCRequestOptions *_requestOptions; GRPCRequestOptions *_requestOptions;
id _requestMessage; id _requestMessage;
@ -193,7 +194,8 @@
_dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); _dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
_cacheable = YES; _cacheable = YES;
_messageSeen = NO; _writeMessageSeen = NO;
_readMessageSeen = NO;
_request = nil; _request = nil;
_response = nil; _response = nil;
} }
@ -202,9 +204,7 @@
- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions - (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions
callOptions:(GRPCCallOptions *)callOptions { callOptions:(GRPCCallOptions *)callOptions {
NSLog(@"start");
if (requestOptions.safety != GRPCCallSafetyCacheableRequest) { if (requestOptions.safety != GRPCCallSafetyCacheableRequest) {
NSLog(@"no cache");
_cacheable = NO; _cacheable = NO;
[_manager startNextInterceptorWithRequest:requestOptions callOptions:callOptions]; [_manager startNextInterceptorWithRequest:requestOptions callOptions:callOptions];
} else { } else {
@ -214,21 +214,19 @@
} }
- (void)writeData:(id)data { - (void)writeData:(id)data {
NSLog(@"writeData");
if (!_cacheable) { if (!_cacheable) {
[_manager writeNextInterceptorWithData:data]; [_manager writeNextInterceptorWithData:data];
} else { } else {
NSAssert(!_messageSeen, @"CacheInterceptor does not support streaming call"); NSAssert(!_writeMessageSeen, @"CacheInterceptor does not support streaming call");
if (_messageSeen) { if (_writeMessageSeen) {
NSLog(@"CacheInterceptor does not support streaming call"); NSLog(@"CacheInterceptor does not support streaming call");
} }
_messageSeen = YES; _writeMessageSeen = YES;
_requestMessage = [data copy]; _requestMessage = [data copy];
} }
} }
- (void)finish { - (void)finish {
NSLog(@"finish");
if (!_cacheable) { if (!_cacheable) {
[_manager finishNextInterceptor]; [_manager finishNextInterceptor];
} else { } else {
@ -236,14 +234,13 @@
_request.path = _requestOptions.path; _request.path = _requestOptions.path;
_request.message = [_requestMessage copy]; _request.message = [_requestMessage copy];
_response = [[_context getCachedResponseForRequest:_request] copy]; _response = [[_context getCachedResponseForRequest:_request] copy];
NSLog(@"Read cache for %@", _request);
if (!_response) { if (!_response) {
[_manager startNextInterceptorWithRequest:_requestOptions callOptions:_callOptions]; [_manager startNextInterceptorWithRequest:_requestOptions callOptions:_callOptions];
[_manager writeNextInterceptorWithData:_requestMessage]; [_manager writeNextInterceptorWithData:_requestMessage];
[_manager finishNextInterceptor]; [_manager finishNextInterceptor];
} else { } else {
[_manager forwardPreviousInterceptorWithInitialMetadata:_response.headers]; [_manager forwardPreviousInterceptorWithInitialMetadata:_response.headers];
[_manager forwardPreviousIntercetporWithData:_response.message]; [_manager forwardPreviousInterceptorWithData:_response.message];
[_manager forwardPreviousInterceptorCloseWithTrailingMetadata:_response.trailers error:nil]; [_manager forwardPreviousInterceptorCloseWithTrailingMetadata:_response.trailers error:nil];
[_manager shutDown]; [_manager shutDown];
} }
@ -251,7 +248,6 @@
} }
- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { - (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata {
NSLog(@"initialMetadata");
if (_cacheable) { if (_cacheable) {
NSDate *deadline = nil; NSDate *deadline = nil;
for (NSString *key in initialMetadata) { for (NSString *key in initialMetadata) {
@ -286,15 +282,18 @@
} }
- (void)didReceiveData:(id)data { - (void)didReceiveData:(id)data {
NSLog(@"receiveData");
if (_cacheable) { if (_cacheable) {
NSAssert(!_readMessageSeen, @"CacheInterceptor does not support streaming call");
if (_readMessageSeen) {
NSLog(@"CacheInterceptor does not support streaming call");
}
_readMessageSeen = YES;
_response.message = [data copy]; _response.message = [data copy];
} }
[_manager forwardPreviousIntercetporWithData:data]; [_manager forwardPreviousInterceptorWithData:data];
} }
- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { - (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error {
NSLog(@"close");
if (error == nil && _cacheable) { if (error == nil && _cacheable) {
_response.trailers = [trailingMetadata copy]; _response.trailers = [trailingMetadata copy];
[_context setCachedResponse:_response forRequest:_request]; [_context setCachedResponse:_response forRequest:_request];

@ -172,19 +172,21 @@ BOOL isRemoteInteropTest(NSString *host) {
@interface HookInterceptorFactory : NSObject<GRPCInterceptorFactory> @interface HookInterceptorFactory : NSObject<GRPCInterceptorFactory>
- (instancetype) - (instancetype)
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue
GRPCInterceptorManager *manager))startHook startHook:(void (^)(GRPCRequestOptions *requestOptions,
writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook GRPCCallOptions *callOptions,
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook GRPCInterceptorManager *manager))startHook
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook
GRPCInterceptorManager *manager))receiveNextMessagesHook finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages,
GRPCInterceptorManager *manager))responseHeaderHook GRPCInterceptorManager *manager))receiveNextMessagesHook
responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook responseHeaderHook:(void (^)(NSDictionary *initialMetadata,
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseHeaderHook
GRPCInterceptorManager *manager))responseCloseHook responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error,
GRPCInterceptorManager *manager))responseCloseHook
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook;
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager;
@ -194,7 +196,8 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages,
- (instancetype) - (instancetype)
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
dispatchQueue:(dispatch_queue_t)dispatchQueue requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue
responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue
startHook:(void (^)(GRPCRequestOptions *requestOptions, startHook:(void (^)(GRPCRequestOptions *requestOptions,
GRPCCallOptions *callOptions, GRPCCallOptions *callOptions,
GRPCInterceptorManager *manager))startHook GRPCInterceptorManager *manager))startHook
@ -222,25 +225,29 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error,
GRPCInterceptorManager *manager); GRPCInterceptorManager *manager);
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager);
dispatch_queue_t _dispatchQueue; dispatch_queue_t _requestDispatchQueue;
dispatch_queue_t _responseDispatchQueue;
} }
- (instancetype) - (instancetype)
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue initWithRequestDispatchQueue:(dispatch_queue_t)requestDispatchQueue
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue
GRPCInterceptorManager *manager))startHook startHook:(void (^)(GRPCRequestOptions *requestOptions,
writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook GRPCCallOptions *callOptions,
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook GRPCInterceptorManager *manager))startHook
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook
GRPCInterceptorManager *manager))receiveNextMessagesHook finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages,
GRPCInterceptorManager *manager))responseHeaderHook GRPCInterceptorManager *manager))receiveNextMessagesHook
responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook responseHeaderHook:(void (^)(NSDictionary *initialMetadata,
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseHeaderHook
GRPCInterceptorManager *manager))responseCloseHook responseDataHook:(void (^)(id data, GRPCInterceptorManager *manager))responseDataHook
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error,
GRPCInterceptorManager *manager))responseCloseHook
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook {
if ((self = [super init])) { if ((self = [super init])) {
_dispatchQueue = dispatchQueue; _requestDispatchQueue = requestDispatchQueue;
_responseDispatchQueue = responseDispatchQueue;
_startHook = startHook; _startHook = startHook;
_writeDataHook = writeDataHook; _writeDataHook = writeDataHook;
_finishHook = finishHook; _finishHook = finishHook;
@ -249,14 +256,14 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages,
_responseDataHook = responseDataHook; _responseDataHook = responseDataHook;
_responseCloseHook = responseCloseHook; _responseCloseHook = responseCloseHook;
_didWriteDataHook = didWriteDataHook; _didWriteDataHook = didWriteDataHook;
_dispatchQueue = dispatchQueue;
} }
return self; return self;
} }
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager {
return [[HookIntercetpor alloc] initWithInterceptorManager:interceptorManager return [[HookIntercetpor alloc] initWithInterceptorManager:interceptorManager
dispatchQueue:_dispatchQueue requestDispatchQueue:_requestDispatchQueue
responseDispatchQueue:_responseDispatchQueue
startHook:_startHook startHook:_startHook
writeDataHook:_writeDataHook writeDataHook:_writeDataHook
finishHook:_finishHook finishHook:_finishHook
@ -281,20 +288,22 @@ receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages,
GRPCInterceptorManager *manager); GRPCInterceptorManager *manager);
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); void (^_didWriteDataHook)(GRPCInterceptorManager *manager);
GRPCInterceptorManager *_manager; GRPCInterceptorManager *_manager;
dispatch_queue_t _dispatchQueue; dispatch_queue_t _requestDispatchQueue;
dispatch_queue_t _responseDispatchQueue;
} }
- (dispatch_queue_t)requestDispatchQueue { - (dispatch_queue_t)requestDispatchQueue {
return _dispatchQueue; return _requestDispatchQueue;
} }
- (dispatch_queue_t)dispatchQueue { - (dispatch_queue_t)dispatchQueue {
return _dispatchQueue; return _responseDispatchQueue;
} }
- (instancetype) - (instancetype)
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
dispatchQueue:(dispatch_queue_t)dispatchQueue requestDispatchQueue:(dispatch_queue_t)requestDispatchQueue
responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue
startHook:(void (^)(GRPCRequestOptions *requestOptions, startHook:(void (^)(GRPCRequestOptions *requestOptions,
GRPCCallOptions *callOptions, GRPCCallOptions *callOptions,
GRPCInterceptorManager *manager))startHook GRPCInterceptorManager *manager))startHook
@ -309,8 +318,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
GRPCInterceptorManager *manager))responseCloseHook GRPCInterceptorManager *manager))responseCloseHook
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook {
if ((self = [super initWithInterceptorManager:interceptorManager if ((self = [super initWithInterceptorManager:interceptorManager
requestDispatchQueue:dispatchQueue requestDispatchQueue:requestDispatchQueue
responseDispatchQueue:dispatchQueue])) { responseDispatchQueue:responseDispatchQueue])) {
_startHook = startHook; _startHook = startHook;
_writeDataHook = writeDataHook; _writeDataHook = writeDataHook;
_finishHook = finishHook; _finishHook = finishHook;
@ -319,7 +328,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
_responseDataHook = responseDataHook; _responseDataHook = responseDataHook;
_responseCloseHook = responseCloseHook; _responseCloseHook = responseCloseHook;
_didWriteDataHook = didWriteDataHook; _didWriteDataHook = didWriteDataHook;
_dispatchQueue = dispatchQueue; _requestDispatchQueue = requestDispatchQueue;
_responseDispatchQueue = responseDispatchQueue;
_manager = interceptorManager; _manager = interceptorManager;
} }
return self; return self;
@ -406,7 +416,6 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
} }
+ (void)setUp { + (void)setUp {
NSLog(@"InteropTest Started, class: %@", [[self class] description]);
#ifdef GRPC_COMPILE_WITH_CRONET #ifdef GRPC_COMPILE_WITH_CRONET
// Cronet setup // Cronet setup
[Cronet setHttp2Enabled:YES]; [Cronet setHttp2Enabled:YES];
@ -1316,8 +1325,6 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
} else { } else {
[call finish]; [call finish];
} }
// DEBUG
NSLog(@"Received message");
} }
closeCallback:^(NSDictionary *trailingMetadata, closeCallback:^(NSDictionary *trailingMetadata,
NSError *error) { NSError *error) {
@ -1328,8 +1335,6 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
@"Received %i responses instead of 4.", @"Received %i responses instead of 4.",
index); index);
[expectation fulfill]; [expectation fulfill];
// DEBUG
NSLog(@"Received close");
}] }]
callOptions:options]; callOptions:options];
[call start]; [call start];
@ -1351,7 +1356,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
__block NSUInteger responseCloseCount = 0; __block NSUInteger responseCloseCount = 0;
__block NSUInteger didWriteDataCount = 0; __block NSUInteger didWriteDataCount = 0;
id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc] id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc]
initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)
responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions,
GRPCInterceptorManager *manager) { GRPCInterceptorManager *manager) {
startCount++; startCount++;
@ -1371,28 +1377,23 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
} }
receiveNextMessagesHook:^(NSUInteger numberOfMessages, GRPCInterceptorManager *manager) { receiveNextMessagesHook:^(NSUInteger numberOfMessages, GRPCInterceptorManager *manager) {
receiveNextMessageCount++; receiveNextMessageCount++;
NSLog(@"Interceptor - receive next messages, %lu", (unsigned long)numberOfMessages);
[manager receiveNextInterceptorMessages:numberOfMessages]; [manager receiveNextInterceptorMessages:numberOfMessages];
} }
responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) {
responseHeaderCount++; responseHeaderCount++;
NSLog(@"Interceptor - received initial metadata, %@", initialMetadata);
[manager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; [manager forwardPreviousInterceptorWithInitialMetadata:initialMetadata];
} }
responseDataHook:^(id data, GRPCInterceptorManager *manager) { responseDataHook:^(id data, GRPCInterceptorManager *manager) {
responseDataCount++; responseDataCount++;
NSLog(@"Interceptor - received data, %@", data); [manager forwardPreviousInterceptorWithData:data];
[manager forwardPreviousIntercetporWithData:data];
} }
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error,
GRPCInterceptorManager *manager) { GRPCInterceptorManager *manager) {
responseCloseCount++; responseCloseCount++;
NSLog(@"Interceptor - received close, %@, %@", trailingMetadata, error);
[manager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata error:error]; [manager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata error:error];
} }
didWriteDataHook:^(GRPCInterceptorManager *manager) { didWriteDataHook:^(GRPCInterceptorManager *manager) {
didWriteDataCount++; didWriteDataCount++;
NSLog(@"Interceptor - received did-write-data");
[manager forwardPreviousInterceptorDidWriteData]; [manager forwardPreviousInterceptorDidWriteData];
}]; }];
@ -1479,7 +1480,8 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
__block NSUInteger responseDataCount = 0; __block NSUInteger responseDataCount = 0;
__block NSUInteger responseCloseCount = 0; __block NSUInteger responseCloseCount = 0;
id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc] id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc]
initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) initWithRequestDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)
responseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions,
GRPCInterceptorManager *manager) { GRPCInterceptorManager *manager) {
startCount++; startCount++;
@ -1492,11 +1494,11 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
[manager writeNextInterceptorWithData:data]; [manager writeNextInterceptorWithData:data];
} else if (index == kCancelAfterWrites) { } else if (index == kCancelAfterWrites) {
[manager cancelNextInterceptor]; [manager cancelNextInterceptor];
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse [manager forwardPreviousInterceptorWithData:[[RMTStreamingOutputCallResponse
messageWithPayloadSize:responses[index]] messageWithPayloadSize:responses[index]]
data]]; data]];
} else { // (index > kCancelAfterWrites) } else { // (index > kCancelAfterWrites)
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse [manager forwardPreviousInterceptorWithData:[[RMTStreamingOutputCallResponse
messageWithPayloadSize:responses[index]] messageWithPayloadSize:responses[index]]
data]]; data]];
} }
@ -1514,7 +1516,7 @@ initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager
} }
responseDataHook:^(id data, GRPCInterceptorManager *manager) { responseDataHook:^(id data, GRPCInterceptorManager *manager) {
responseDataCount++; responseDataCount++;
[manager forwardPreviousIntercetporWithData:data]; [manager forwardPreviousInterceptorWithData:data];
} }
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error,
GRPCInterceptorManager *manager) { GRPCInterceptorManager *manager) {

Loading…
Cancel
Save