murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2015, Google Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 34 | #import "GRPCWrappedCall.h" |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 35 | #import <Foundation/Foundation.h> |
| 36 | #include <grpc/grpc.h> |
| 37 | #include <grpc/byte_buffer.h> |
| 38 | #include <grpc/support/alloc.h> |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 39 | #import "GRPCCompletionQueue.h" |
| 40 | #import "NSDictionary+GRPC.h" |
| 41 | #import "NSData+GRPC.h" |
| 42 | #import "NSError+GRPC.h" |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 43 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 44 | @implementation GRPCOperation { |
| 45 | @protected |
Jorge Canizales | 8848704 | 2015-06-21 21:59:37 -0700 | [diff] [blame] | 46 | // Most operation subclasses don't set any flags in the grpc_op, and rely on the flag member being |
| 47 | // initialized to zero. |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 48 | grpc_op _op; |
| 49 | void(^_handler)(); |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 52 | - (void)finish { |
| 53 | if (_handler) { |
| 54 | _handler(); |
| 55 | } |
| 56 | } |
| 57 | @end |
| 58 | |
| 59 | @implementation GRPCOpSendMetadata |
| 60 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 61 | - (instancetype)init { |
| 62 | return [self initWithMetadata:nil handler:nil]; |
| 63 | } |
| 64 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 65 | - (instancetype)initWithMetadata:(NSDictionary *)metadata handler:(void (^)())handler { |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 66 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 67 | _op.op = GRPC_OP_SEND_INITIAL_METADATA; |
| 68 | _op.data.send_initial_metadata.count = metadata.count; |
| 69 | _op.data.send_initial_metadata.metadata = metadata.grpc_metadataArray; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 70 | _handler = handler; |
| 71 | } |
| 72 | return self; |
| 73 | } |
| 74 | |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 75 | - (void)dealloc { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 76 | gpr_free(_op.data.send_initial_metadata.metadata); |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 77 | } |
| 78 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 79 | @end |
| 80 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 81 | @implementation GRPCOpSendMessage |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 82 | |
| 83 | - (instancetype)init { |
| 84 | return [self initWithMessage:nil handler:nil]; |
| 85 | } |
| 86 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 87 | - (instancetype)initWithMessage:(NSData *)message handler:(void (^)())handler { |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 88 | if (!message) { |
murgatroid99 | 2101a48 | 2015-04-29 11:42:26 -0700 | [diff] [blame] | 89 | [NSException raise:NSInvalidArgumentException format:@"message cannot be nil"]; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 90 | } |
| 91 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 92 | _op.op = GRPC_OP_SEND_MESSAGE; |
| 93 | _op.data.send_message = message.grpc_byteBuffer; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 94 | _handler = handler; |
| 95 | } |
| 96 | return self; |
| 97 | } |
| 98 | |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 99 | - (void)dealloc { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 100 | gpr_free(_op.data.send_message); |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 101 | } |
| 102 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 103 | @end |
| 104 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 105 | @implementation GRPCOpSendClose |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 106 | |
| 107 | - (instancetype)init { |
| 108 | return [self initWithHandler:nil]; |
| 109 | } |
| 110 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 111 | - (instancetype)initWithHandler:(void (^)())handler { |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 112 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 113 | _op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 114 | _handler = handler; |
| 115 | } |
| 116 | return self; |
| 117 | } |
| 118 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 119 | @end |
| 120 | |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 121 | @implementation GRPCOpRecvMetadata { |
| 122 | grpc_metadata_array _headers; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | - (instancetype) init { |
| 126 | return [self initWithHandler:nil]; |
| 127 | } |
| 128 | |
| 129 | - (instancetype) initWithHandler:(void (^)(NSDictionary *))handler { |
| 130 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 131 | _op.op = GRPC_OP_RECV_INITIAL_METADATA; |
| 132 | grpc_metadata_array_init(&_headers); |
| 133 | _op.data.recv_initial_metadata = &_headers; |
| 134 | if (handler) { |
murgatroid99 | 231103b | 2015-06-25 10:14:09 -0700 | [diff] [blame] | 135 | // Prevent reference cycle with _handler |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 136 | __weak typeof(self) weakSelf = self; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 137 | _handler = ^{ |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 138 | __strong typeof(self) strongSelf = weakSelf; |
| 139 | NSDictionary *metadata = [NSDictionary |
| 140 | grpc_dictionaryFromMetadataArray:strongSelf->_headers]; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 141 | handler(metadata); |
| 142 | }; |
| 143 | } |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 144 | } |
| 145 | return self; |
| 146 | } |
| 147 | |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 148 | - (void)dealloc { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 149 | grpc_metadata_array_destroy(&_headers); |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 150 | } |
| 151 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 152 | @end |
| 153 | |
| 154 | @implementation GRPCOpRecvMessage{ |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 155 | grpc_byte_buffer *_receivedMessage; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | - (instancetype)init { |
| 159 | return [self initWithHandler:nil]; |
| 160 | } |
| 161 | |
murgatroid99 | 6cc4680 | 2015-04-28 09:35:48 -0700 | [diff] [blame] | 162 | - (instancetype)initWithHandler:(void (^)(grpc_byte_buffer *))handler { |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 163 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 164 | _op.op = GRPC_OP_RECV_MESSAGE; |
| 165 | _op.data.recv_message = &_receivedMessage; |
| 166 | if (handler) { |
murgatroid99 | 231103b | 2015-06-25 10:14:09 -0700 | [diff] [blame] | 167 | // Prevent reference cycle with _handler |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 168 | __weak typeof(self) weakSelf = self; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 169 | _handler = ^{ |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 170 | __strong typeof(self) strongSelf = weakSelf; |
| 171 | handler(strongSelf->_receivedMessage); |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 172 | }; |
| 173 | } |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 174 | } |
| 175 | return self; |
| 176 | } |
| 177 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 178 | @end |
| 179 | |
| 180 | @implementation GRPCOpRecvStatus{ |
Jorge Canizales | f3a4f2c | 2015-06-12 22:12:50 -0700 | [diff] [blame] | 181 | grpc_status_code _statusCode; |
| 182 | char *_details; |
murgatroid99 | ca38ddb | 2015-04-29 13:16:42 -0700 | [diff] [blame] | 183 | size_t _detailsCapacity; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 184 | grpc_metadata_array _trailers; |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | - (instancetype) init { |
| 188 | return [self initWithHandler:nil]; |
| 189 | } |
| 190 | |
Jorge Canizales | f3a4f2c | 2015-06-12 22:12:50 -0700 | [diff] [blame] | 191 | - (instancetype) initWithHandler:(void (^)(NSError *, NSDictionary *))handler { |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 192 | if (self = [super init]) { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 193 | _op.op = GRPC_OP_RECV_STATUS_ON_CLIENT; |
| 194 | _op.data.recv_status_on_client.status = &_statusCode; |
| 195 | _op.data.recv_status_on_client.status_details = &_details; |
| 196 | _op.data.recv_status_on_client.status_details_capacity = &_detailsCapacity; |
| 197 | grpc_metadata_array_init(&_trailers); |
| 198 | _op.data.recv_status_on_client.trailing_metadata = &_trailers; |
| 199 | if (handler) { |
murgatroid99 | 231103b | 2015-06-25 10:14:09 -0700 | [diff] [blame] | 200 | // Prevent reference cycle with _handler |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 201 | __weak typeof(self) weakSelf = self; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 202 | _handler = ^{ |
murgatroid99 | dbda969 | 2015-06-24 16:55:55 -0700 | [diff] [blame] | 203 | __strong typeof(self) strongSelf = weakSelf; |
| 204 | NSError *error = [NSError grpc_errorFromStatusCode:strongSelf->_statusCode |
| 205 | details:strongSelf->_details]; |
| 206 | NSDictionary *trailers = [NSDictionary |
| 207 | grpc_dictionaryFromMetadataArray:strongSelf->_trailers]; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 208 | handler(error, trailers); |
| 209 | }; |
| 210 | } |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 211 | } |
| 212 | return self; |
| 213 | } |
| 214 | |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 215 | - (void)dealloc { |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 216 | grpc_metadata_array_destroy(&_trailers); |
Jorge Canizales | f3a4f2c | 2015-06-12 22:12:50 -0700 | [diff] [blame] | 217 | gpr_free(_details); |
murgatroid99 | 33655f9 | 2015-04-29 11:15:35 -0700 | [diff] [blame] | 218 | } |
| 219 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 220 | @end |
| 221 | |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 222 | @implementation GRPCWrappedCall{ |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 223 | grpc_call *_call; |
| 224 | GRPCCompletionQueue *_queue; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | - (instancetype)init { |
murgatroid99 | 463a7a8 | 2015-04-24 11:41:43 -0700 | [diff] [blame] | 228 | return [self initWithChannel:nil method:nil host:nil]; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 229 | } |
| 230 | |
murgatroid99 | 6cc4680 | 2015-04-28 09:35:48 -0700 | [diff] [blame] | 231 | - (instancetype)initWithChannel:(GRPCChannel *)channel |
| 232 | method:(NSString *)method |
| 233 | host:(NSString *)host { |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 234 | if (!channel || !method || !host) { |
murgatroid99 | 6cc4680 | 2015-04-28 09:35:48 -0700 | [diff] [blame] | 235 | [NSException raise:NSInvalidArgumentException |
| 236 | format:@"channel, method, and host cannot be nil."]; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | if (self = [super init]) { |
| 240 | static dispatch_once_t initialization; |
| 241 | dispatch_once(&initialization, ^{ |
| 242 | grpc_init(); |
| 243 | }); |
| 244 | |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 245 | _queue = [GRPCCompletionQueue completionQueue]; |
murgatroid99 | fe2c0c6 | 2015-04-29 10:59:43 -0700 | [diff] [blame] | 246 | if (!_queue) { |
| 247 | return nil; |
| 248 | } |
murgatroid99 | 6cc4680 | 2015-04-28 09:35:48 -0700 | [diff] [blame] | 249 | _call = grpc_channel_create_call(channel.unmanagedChannel, _queue.unmanagedQueue, |
| 250 | method.UTF8String, host.UTF8String, gpr_inf_future); |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 251 | if (_call == NULL) { |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 252 | return nil; |
| 253 | } |
| 254 | } |
| 255 | return self; |
| 256 | } |
| 257 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 258 | - (void)startBatchWithOperations:(NSArray *)operations { |
| 259 | [self startBatchWithOperations:operations errorHandler:nil]; |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 260 | } |
| 261 | |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 262 | - (void)startBatchWithOperations:(NSArray *)operations errorHandler:(void (^)())errorHandler { |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 263 | size_t nops = operations.count; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 264 | grpc_op *ops_array = gpr_malloc(nops * sizeof(grpc_op)); |
murgatroid99 | 54e93d4 | 2015-04-27 09:29:49 -0700 | [diff] [blame] | 265 | size_t i = 0; |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 266 | for (GRPCOperation *operation in operations) { |
| 267 | ops_array[i++] = operation.op; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 268 | } |
murgatroid99 | 6cc4680 | 2015-04-28 09:35:48 -0700 | [diff] [blame] | 269 | grpc_call_error error = grpc_call_start_batch(_call, ops_array, nops, |
murgatroid99 | 6b54244 | 2015-05-08 10:40:01 -0700 | [diff] [blame] | 270 | (__bridge_retained void *)(^(bool success){ |
| 271 | if (!success) { |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 272 | if (errorHandler) { |
| 273 | errorHandler(); |
| 274 | } else { |
murgatroid99 | def47aa | 2015-04-29 10:28:26 -0700 | [diff] [blame] | 275 | return; |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 276 | } |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 277 | } |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 278 | for (GRPCOperation *operation in operations) { |
murgatroid99 | 2101a48 | 2015-04-29 11:42:26 -0700 | [diff] [blame] | 279 | [operation finish]; |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 280 | } |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 281 | })); |
Jorge Canizales | 8d99775 | 2015-06-21 21:43:26 -0700 | [diff] [blame] | 282 | gpr_free(ops_array); |
| 283 | |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 284 | if (error != GRPC_CALL_OK) { |
murgatroid99 | 6a084f4 | 2015-04-29 10:18:05 -0700 | [diff] [blame] | 285 | [NSException raise:NSInternalInconsistencyException |
Jorge Canizales | bae38d9 | 2015-06-20 20:21:25 -0700 | [diff] [blame] | 286 | format:@"A precondition for calling grpc_call_start_batch wasn't met. Error %i", |
| 287 | error]; |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 288 | } |
| 289 | } |
| 290 | |
| 291 | - (void)cancel { |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 292 | grpc_call_cancel(_call); |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | - (void)dealloc { |
murgatroid99 | 69927d6 | 2015-04-24 13:32:48 -0700 | [diff] [blame] | 296 | grpc_call_destroy(_call); |
murgatroid99 | 30b7d4e | 2015-04-24 10:36:43 -0700 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | @end |