Merge pull request #6 from murgatroid99/objective_c_completion_queue_update

Updated Objective C code to match completion queue changes
pull/1472/head
Craig Tiller 10 years ago
commit f00454a646
  1. BIN
      src/objective-c/GRPCClient/.DS_Store
  2. BIN
      src/objective-c/GRPCClient/private/.DS_Store
  3. 2
      src/objective-c/GRPCClient/private/GRPCCompletionQueue.h
  4. 11
      src/objective-c/GRPCClient/private/GRPCCompletionQueue.m
  5. 4
      src/objective-c/GRPCClient/private/GRPCWrappedCall.m

Binary file not shown.

Binary file not shown.

@ -34,7 +34,7 @@
#import <Foundation/Foundation.h>
#include <grpc/grpc.h>
typedef void(^GRPCQueueCompletionHandler)(grpc_op_error error);
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

@ -65,20 +65,17 @@
dispatch_async(gDefaultConcurrentQueue, ^{
while (YES) {
// The following call blocks until an event is available.
grpc_event *event = grpc_completion_queue_next(unmanagedQueue, gpr_inf_future);
grpc_event event = grpc_completion_queue_next(unmanagedQueue, gpr_inf_future);
GRPCQueueCompletionHandler handler;
switch (event->type) {
switch (event.type) {
case GRPC_OP_COMPLETE:
handler = (__bridge_transfer GRPCQueueCompletionHandler)event->tag;
handler(event->data.op_complete);
grpc_event_finish(event);
handler = (__bridge_transfer GRPCQueueCompletionHandler)event.tag;
handler(event.success);
break;
case GRPC_QUEUE_SHUTDOWN:
grpc_event_finish(event);
grpc_completion_queue_destroy(unmanagedQueue);
return;
default:
grpc_event_finish(event);
[NSException raise:@"Unrecognized completion type" format:@""];
}
};

@ -296,8 +296,8 @@
[op getOp:&ops_array[i++]];
}
grpc_call_error error = grpc_call_start_batch(_call, ops_array, nops,
(__bridge_retained void *)(^(grpc_op_error error){
if (error != GRPC_OP_OK) {
(__bridge_retained void *)(^(bool success){
if (!success) {
if (errorHandler) {
errorHandler();
} else {

Loading…
Cancel
Save