diff options
author | Jorge Canizales <jcanizales@google.com> | 2015-06-17 14:10:52 -0700 |
---|---|---|
committer | Jorge Canizales <jcanizales@google.com> | 2015-06-17 14:10:52 -0700 |
commit | 6bbfcc3fec703438690f308f3a706f58c87380e1 (patch) | |
tree | b851f380d2363629202a732092489d0e43ef8905 /src | |
parent | 0d6cf992e8f840ae257c039f15fc045e9605090f (diff) |
Disallow started request writers on GRPCCall init
Diffstat (limited to 'src')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 279ef935d5..687932c938 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -100,7 +100,9 @@ NSString * const kGRPCStatusMetadataKey = @"io.grpc.StatusMetadataKey"; if (!host || !method) { [NSException raise:NSInvalidArgumentException format:@"Neither host nor method can be nil."]; } - // TODO(jcanizales): Throw if the requestWriter was already started. + if (requestWriter.state != GRXWriterStateNotStarted) { + [NSException raise:NSInvalidArgumentException format:@"The requests writer can't be already started."]; + } if ((self = [super init])) { static dispatch_once_t initialization; dispatch_once(&initialization, ^{ |