|
|
@ -171,14 +171,19 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
|
|
|
|
|
|
|
|
@interface HookInterceptorFactory : NSObject<GRPCInterceptorFactory> |
|
|
|
@interface HookInterceptorFactory : NSObject<GRPCInterceptorFactory> |
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
- (instancetype) |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook |
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; |
|
|
|
|
|
|
|
|
|
|
|
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; |
|
|
|
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager; |
|
|
@ -187,39 +192,52 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
|
|
|
|
|
|
|
|
@interface HookIntercetpor : GRPCInterceptor |
|
|
|
@interface HookIntercetpor : GRPCInterceptor |
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
- (instancetype) |
|
|
|
|
|
|
|
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook; |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation HookInterceptorFactory { |
|
|
|
@implementation HookInterceptorFactory { |
|
|
|
void (^_startHook)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager); |
|
|
|
void (^_startHook)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager); |
|
|
|
void (^_writeDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_writeDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_finishHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_finishHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_receiveNextMessagesHook)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager); |
|
|
|
void (^_receiveNextMessagesHook)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseHeaderHook)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseHeaderHook)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager); |
|
|
|
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); |
|
|
|
dispatch_queue_t _dispatchQueue; |
|
|
|
dispatch_queue_t _dispatchQueue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
- (instancetype) |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook |
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { |
|
|
|
if ((self = [super init])) { |
|
|
|
if ((self = [super init])) { |
|
|
|
_dispatchQueue = dispatchQueue; |
|
|
|
_dispatchQueue = dispatchQueue; |
|
|
@ -252,13 +270,15 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation HookIntercetpor { |
|
|
|
@implementation HookIntercetpor { |
|
|
|
void (^_startHook)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager); |
|
|
|
void (^_startHook)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager); |
|
|
|
void (^_writeDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_writeDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_finishHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_finishHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_receiveNextMessagesHook)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager); |
|
|
|
void (^_receiveNextMessagesHook)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseHeaderHook)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseHeaderHook)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseDataHook)(NSData *data, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager); |
|
|
|
void (^_responseCloseHook)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager); |
|
|
|
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); |
|
|
|
void (^_didWriteDataHook)(GRPCInterceptorManager *manager); |
|
|
|
GRPCInterceptorManager *_manager; |
|
|
|
GRPCInterceptorManager *_manager; |
|
|
|
dispatch_queue_t _dispatchQueue; |
|
|
|
dispatch_queue_t _dispatchQueue; |
|
|
@ -272,17 +292,25 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
return _dispatchQueue; |
|
|
|
return _dispatchQueue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (instancetype)initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
- (instancetype) |
|
|
|
|
|
|
|
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager))startHook |
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
writeDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseDataHook:(void (^)(NSData *data, GRPCInterceptorManager *manager))responseDataHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { |
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { |
|
|
|
if ((self = [super initWithInterceptorManager:interceptorManager requestDispatchQueue:dispatchQueue responseDispatchQueue:dispatchQueue])) { |
|
|
|
if ((self = [super initWithInterceptorManager:interceptorManager |
|
|
|
|
|
|
|
requestDispatchQueue:dispatchQueue |
|
|
|
|
|
|
|
responseDispatchQueue:dispatchQueue])) { |
|
|
|
_startHook = startHook; |
|
|
|
_startHook = startHook; |
|
|
|
_writeDataHook = writeDataHook; |
|
|
|
_writeDataHook = writeDataHook; |
|
|
|
_finishHook = finishHook; |
|
|
|
_finishHook = finishHook; |
|
|
@ -1322,15 +1350,17 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
__block NSUInteger responseDataCount = 0; |
|
|
|
__block NSUInteger responseDataCount = 0; |
|
|
|
__block NSUInteger responseCloseCount = 0; |
|
|
|
__block NSUInteger responseCloseCount = 0; |
|
|
|
__block NSUInteger didWriteDataCount = 0; |
|
|
|
__block NSUInteger didWriteDataCount = 0; |
|
|
|
id<GRPCInterceptorFactory> factory = |
|
|
|
id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc] |
|
|
|
[[HookInterceptorFactory alloc] initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) |
|
|
|
initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) |
|
|
|
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { |
|
|
|
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager) { |
|
|
|
startCount++; |
|
|
|
startCount++; |
|
|
|
NSLog(@"Interceptor - started call, %@, %@", requestOptions, callOptions); |
|
|
|
NSLog(@"Interceptor - started call, %@, %@", requestOptions, callOptions); |
|
|
|
XCTAssertEqualObjects(requestOptions.host, [[self class] host]); |
|
|
|
XCTAssertEqualObjects(requestOptions.host, [[self class] host]); |
|
|
|
XCTAssertEqualObjects(requestOptions.path, @"/grpc.testing.TestService/FullDuplexCall"); |
|
|
|
XCTAssertEqualObjects(requestOptions.path, @"/grpc.testing.TestService/FullDuplexCall"); |
|
|
|
XCTAssertEqual(requestOptions.safety, GRPCCallSafetyDefault); |
|
|
|
XCTAssertEqual(requestOptions.safety, GRPCCallSafetyDefault); |
|
|
|
[manager startNextInterceptorWithRequest:[requestOptions copy] callOptions:[callOptions copy]]; |
|
|
|
[manager startNextInterceptorWithRequest:[requestOptions copy] |
|
|
|
|
|
|
|
callOptions:[callOptions copy]]; |
|
|
|
} |
|
|
|
} |
|
|
|
writeDataHook:^(NSData *data, GRPCInterceptorManager *manager) { |
|
|
|
writeDataHook:^(NSData *data, GRPCInterceptorManager *manager) { |
|
|
|
writeDataCount++; |
|
|
|
writeDataCount++; |
|
|
@ -1359,11 +1389,11 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
XCTAssertNotEqual(data.length, 0); |
|
|
|
XCTAssertNotEqual(data.length, 0); |
|
|
|
[manager forwardPreviousIntercetporWithData:data]; |
|
|
|
[manager forwardPreviousIntercetporWithData:data]; |
|
|
|
} |
|
|
|
} |
|
|
|
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager) { |
|
|
|
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager) { |
|
|
|
responseCloseCount++; |
|
|
|
responseCloseCount++; |
|
|
|
NSLog(@"Interceptor - received close, %@, %@", trailingMetadata, error); |
|
|
|
NSLog(@"Interceptor - received close, %@, %@", trailingMetadata, error); |
|
|
|
[manager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata |
|
|
|
[manager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata error:error]; |
|
|
|
error:error]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
didWriteDataHook:^(GRPCInterceptorManager *manager) { |
|
|
|
didWriteDataHook:^(GRPCInterceptorManager *manager) { |
|
|
|
didWriteDataCount++; |
|
|
|
didWriteDataCount++; |
|
|
@ -1453,11 +1483,13 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
__block NSUInteger responseHeaderCount = 0; |
|
|
|
__block NSUInteger responseHeaderCount = 0; |
|
|
|
__block NSUInteger responseDataCount = 0; |
|
|
|
__block NSUInteger responseDataCount = 0; |
|
|
|
__block NSUInteger responseCloseCount = 0; |
|
|
|
__block NSUInteger responseCloseCount = 0; |
|
|
|
id<GRPCInterceptorFactory> factory = |
|
|
|
id<GRPCInterceptorFactory> factory = [[HookInterceptorFactory alloc] |
|
|
|
[[HookInterceptorFactory alloc] initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) |
|
|
|
initWithDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) |
|
|
|
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, GRPCInterceptorManager *manager) { |
|
|
|
startHook:^(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager) { |
|
|
|
startCount++; |
|
|
|
startCount++; |
|
|
|
[manager startNextInterceptorWithRequest:[requestOptions copy] callOptions:[callOptions copy]]; |
|
|
|
[manager startNextInterceptorWithRequest:[requestOptions copy] |
|
|
|
|
|
|
|
callOptions:[callOptions copy]]; |
|
|
|
} |
|
|
|
} |
|
|
|
writeDataHook:^(NSData *data, GRPCInterceptorManager *manager) { |
|
|
|
writeDataHook:^(NSData *data, GRPCInterceptorManager *manager) { |
|
|
|
writeDataCount++; |
|
|
|
writeDataCount++; |
|
|
@ -1465,15 +1497,20 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
[manager writeNextInterceptorWithData:data]; |
|
|
|
[manager writeNextInterceptorWithData:data]; |
|
|
|
} else if (index == kCancelAfterWrites) { |
|
|
|
} else if (index == kCancelAfterWrites) { |
|
|
|
[manager cancelNextInterceptor]; |
|
|
|
[manager cancelNextInterceptor]; |
|
|
|
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse messageWithPayloadSize:responses[index]] data]]; |
|
|
|
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse |
|
|
|
|
|
|
|
messageWithPayloadSize:responses[index]] |
|
|
|
|
|
|
|
data]]; |
|
|
|
} else { // (index > kCancelAfterWrites) |
|
|
|
} else { // (index > kCancelAfterWrites) |
|
|
|
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse messageWithPayloadSize:responses[index]] data]]; |
|
|
|
[manager forwardPreviousIntercetporWithData:[[RMTStreamingOutputCallResponse |
|
|
|
|
|
|
|
messageWithPayloadSize:responses[index]] |
|
|
|
|
|
|
|
data]]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
finishHook:^(GRPCInterceptorManager *manager) { |
|
|
|
finishHook:^(GRPCInterceptorManager *manager) { |
|
|
|
finishCount++; |
|
|
|
finishCount++; |
|
|
|
// finish must happen after the hijacking, so directly reply with a close |
|
|
|
// finish must happen after the hijacking, so directly reply with a close |
|
|
|
[manager forwardPreviousInterceptorCloseWithTrailingMetadata:@{ @"grpc-status" : @"0" } error:nil]; |
|
|
|
[manager forwardPreviousInterceptorCloseWithTrailingMetadata:@{@"grpc-status" : @"0"} |
|
|
|
|
|
|
|
error:nil]; |
|
|
|
} |
|
|
|
} |
|
|
|
receiveNextMessagesHook:nil |
|
|
|
receiveNextMessagesHook:nil |
|
|
|
responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { |
|
|
|
responseHeaderHook:^(NSDictionary *initialMetadata, GRPCInterceptorManager *manager) { |
|
|
@ -1484,7 +1521,8 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
responseDataCount++; |
|
|
|
responseDataCount++; |
|
|
|
[manager forwardPreviousIntercetporWithData:data]; |
|
|
|
[manager forwardPreviousIntercetporWithData:data]; |
|
|
|
} |
|
|
|
} |
|
|
|
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, GRPCInterceptorManager *manager) { |
|
|
|
responseCloseHook:^(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
|
|
|
GRPCInterceptorManager *manager) { |
|
|
|
responseCloseCount++; |
|
|
|
responseCloseCount++; |
|
|
|
// since we canceled the call, it should return cancel error |
|
|
|
// since we canceled the call, it should return cancel error |
|
|
|
XCTAssertNil(trailingMetadata); |
|
|
|
XCTAssertNil(trailingMetadata); |
|
|
|