From 597ef98693d8af19a894ecd95537669657197e41 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 31 Jul 2015 23:31:56 -0700 Subject: [PATCH 1/4] GRPCCall.m formatting. --- src/objective-c/GRPCClient/GRPCCall.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 9435bf2b35c..dd8e183a483 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -100,10 +100,11 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; path:(NSString *)path requestsWriter:(GRXWriter *)requestWriter { if (!host || !path) { - [NSException raise:NSInvalidArgumentException format:@"Neither host nor method can be nil."]; + [NSException raise:NSInvalidArgumentException format:@"Neither host nor path can be nil."]; } if (requestWriter.state != GRXWriterStateNotStarted) { - [NSException raise:NSInvalidArgumentException format:@"The requests writer can't be already started."]; + [NSException raise:NSInvalidArgumentException + format:@"The requests writer can't be already started."]; } if ((self = [super init])) { static dispatch_once_t initialization; From 9e51972d221a974d87c9cefa350a9a4f90063af9 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 31 Jul 2015 23:32:34 -0700 Subject: [PATCH 2/4] grpc_init() is already called in GRPCWrappedCall --- src/objective-c/GRPCClient/GRPCCall.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index dd8e183a483..e542835c50f 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -107,11 +107,6 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; format:@"The requests writer can't be already started."]; } if ((self = [super init])) { - static dispatch_once_t initialization; - dispatch_once(&initialization, ^{ - grpc_init(); - }); - _completionQueue = [GRPCCompletionQueue completionQueue]; _channel = [GRPCChannel channelToHost:host]; From 013f87a9a727ec977e338164b64085efc8bc53ca Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 31 Jul 2015 23:34:04 -0700 Subject: [PATCH 3/4] Unused ivar in GRPCCall.m --- src/objective-c/GRPCClient/GRPCCall.m | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index e542835c50f..9d9648ae28a 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -38,7 +38,6 @@ #import #import "private/GRPCChannel.h" -#import "private/GRPCCompletionQueue.h" #import "private/GRPCWrappedCall.h" #import "private/NSData+GRPC.h" #import "private/NSDictionary+GRPC.h" @@ -72,7 +71,6 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; dispatch_once_t _callAlreadyInvoked; GRPCChannel *_channel; - GRPCCompletionQueue *_completionQueue; // The C gRPC library has less guarantees on the ordering of events than we // do. Particularly, in the face of errors, there's no ordering guarantee at @@ -107,8 +105,6 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; format:@"The requests writer can't be already started."]; } if ((self = [super init])) { - _completionQueue = [GRPCCompletionQueue completionQueue]; - _channel = [GRPCChannel channelToHost:host]; _wrappedCall = [[GRPCWrappedCall alloc] initWithChannel:_channel From faf58b84b5076ed4e20d825b2961d9313cd45649 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sat, 1 Aug 2015 16:50:28 -0700 Subject: [PATCH 4/4] Update doc in GRPCCompletionQueue.h --- .../GRPCClient/private/GRPCCompletionQueue.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h index 603bf019391..ab8d714d220 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h @@ -36,15 +36,15 @@ typedef void(^GRPCQueueCompletionHandler)(bool success); -// This class lets one more easily use grpc_completion_queue. To use it, pass -// the value of the unmanagedQueue property of an instance of this class to -// grpc_call_start_invoke. Then for every grpc_call_* method that accepts a tag, -// you can pass a block of type GRPCEventHandler (remembering to cast it using -// __bridge_retained). The block is guaranteed to eventually be called, by a -// concurrent queue, and then released. Each such block is passed a pointer to -// the grpc_event that carried it (in event->tag). -// Release the GRPCCompletionQueue object only after you are not going to pass -// any more blocks to the grpc_call that's using it. +// This class lets one more easily use |grpc_completion_queue|. To use it, pass the value of the +// |unmanagedQueue| property of an instance of this class to |grpc_channel_create_call|. Then for +// every |grpc_call_*| method that accepts a tag, you can pass a block of type +// |GRPCQueueCompletionHandler| (remembering to cast it using |__bridge_retained|). The block is +// guaranteed to eventually be called, by a concurrent queue, and then released. Each such block is +// passed a |bool| that tells if the operation was successful. +// +// Release the GRPCCompletionQueue object only after you are not going to pass any more blocks to +// the |grpc_call| that's using it. @interface GRPCCompletionQueue : NSObject @property(nonatomic, readonly) grpc_completion_queue *unmanagedQueue;