|
46 | 46 | static NSString *const kAuthorizationHeader = @"authorization";
|
47 | 47 | static NSString *const kBearerPrefix = @"Bearer ";
|
48 | 48 |
|
49 |
| -@interface GRPCCall ()<GRXWriteable> |
| 49 | +@interface GRPCCall () <GRXWriteable> |
50 | 50 | // Make them read-write.
|
51 | 51 | @property(atomic, strong) NSDictionary *responseHeaders;
|
52 | 52 | @property(atomic, strong) NSDictionary *responseTrailers;
|
@@ -429,8 +429,8 @@ - (void)writeMessage:(NSData *)message withErrorHandler:(void (^)(void))errorHan
|
429 | 429 | }
|
430 | 430 | }
|
431 | 431 | };
|
432 |
| - GRPCOpSendMessage *op = |
433 |
| - [[GRPCOpSendMessage alloc] initWithMessage:message handler:resumingHandler]; |
| 432 | + GRPCOpSendMessage *op = [[GRPCOpSendMessage alloc] initWithMessage:message |
| 433 | + handler:resumingHandler]; |
434 | 434 | if (!_unaryCall) {
|
435 | 435 | [_wrappedCall startBatchWithOperations:@[ op ] errorHandler:errorHandler];
|
436 | 436 | } else {
|
@@ -501,22 +501,23 @@ - (void)invokeCallWithHeadersHandler:(void (^)(NSDictionary *))headersHandler
|
501 | 501 |
|
502 | 502 | - (void)invokeCall {
|
503 | 503 | __weak GRPCCall *weakSelf = self;
|
504 |
| - [self invokeCallWithHeadersHandler:^(NSDictionary *headers) { |
505 |
| - // Response headers received. |
506 |
| - __strong GRPCCall *strongSelf = weakSelf; |
507 |
| - if (strongSelf) { |
508 |
| - @synchronized(strongSelf) { |
509 |
| - // it is ok to set nil because headers are only received once |
510 |
| - strongSelf.responseHeaders = nil; |
511 |
| - // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed |
512 |
| - NSDictionary *copiedHeaders = |
513 |
| - [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; |
514 |
| - strongSelf.responseHeaders = copiedHeaders; |
515 |
| - strongSelf->_pendingCoreRead = NO; |
516 |
| - [strongSelf maybeStartNextRead]; |
| 504 | + [self |
| 505 | + invokeCallWithHeadersHandler:^(NSDictionary *headers) { |
| 506 | + // Response headers received. |
| 507 | + __strong GRPCCall *strongSelf = weakSelf; |
| 508 | + if (strongSelf) { |
| 509 | + @synchronized(strongSelf) { |
| 510 | + // it is ok to set nil because headers are only received once |
| 511 | + strongSelf.responseHeaders = nil; |
| 512 | + // copy the header so that the GRPCOpRecvMetadata object may be dealloc'ed |
| 513 | + NSDictionary *copiedHeaders = [[NSDictionary alloc] initWithDictionary:headers |
| 514 | + copyItems:YES]; |
| 515 | + strongSelf.responseHeaders = copiedHeaders; |
| 516 | + strongSelf->_pendingCoreRead = NO; |
| 517 | + [strongSelf maybeStartNextRead]; |
| 518 | + } |
| 519 | + } |
517 | 520 | }
|
518 |
| - } |
519 |
| - } |
520 | 521 | completionHandler:^(NSError *error, NSDictionary *trailers) {
|
521 | 522 | __strong GRPCCall *strongSelf = weakSelf;
|
522 | 523 | if (strongSelf) {
|
@@ -548,11 +549,11 @@ - (void)startCallWithWriteable:(id<GRXWriteable>)writeable {
|
548 | 549 | return;
|
549 | 550 | }
|
550 | 551 |
|
551 |
| - _responseWriteable = |
552 |
| - [[GRXConcurrentWriteable alloc] initWithWriteable:writeable dispatchQueue:_responseQueue]; |
| 552 | + _responseWriteable = [[GRXConcurrentWriteable alloc] initWithWriteable:writeable |
| 553 | + dispatchQueue:_responseQueue]; |
553 | 554 |
|
554 |
| - GRPCPooledChannel *channel = |
555 |
| - [[GRPCChannelPool sharedInstance] channelWithHost:_host callOptions:_callOptions]; |
| 555 | + GRPCPooledChannel *channel = [[GRPCChannelPool sharedInstance] channelWithHost:_host |
| 556 | + callOptions:_callOptions]; |
556 | 557 | _wrappedCall = [channel wrappedCallWithPath:_path
|
557 | 558 | completionQueue:[GRPCCompletionQueue completionQueue]
|
558 | 559 | callOptions:_callOptions];
|
|
0 commit comments