|  | @@ -529,6 +529,38 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) {
 | 
	
		
			
				|  |  |    grpc_call_unref(call);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +typedef grpc_call_error (*grpcsharp_call_start_batch_func)(grpc_call *call,
 | 
	
		
			
				|  |  | +                                                           const grpc_op *ops,
 | 
	
		
			
				|  |  | +                                                           size_t nops,
 | 
	
		
			
				|  |  | +                                                           void *tag,
 | 
	
		
			
				|  |  | +                                                           void *reserved);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Only for testing */
 | 
	
		
			
				|  |  | +static grpc_call_error grpcsharp_call_start_batch_nop(grpc_call *call,
 | 
	
		
			
				|  |  | +                                                      const grpc_op *ops,
 | 
	
		
			
				|  |  | +                                                      size_t nops, void *tag,
 | 
	
		
			
				|  |  | +                                                      void *reserved) {
 | 
	
		
			
				|  |  | +  return GRPC_CALL_OK;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static grpc_call_error grpcsharp_call_start_batch_default(grpc_call *call,
 | 
	
		
			
				|  |  | +                                                          const grpc_op *ops,
 | 
	
		
			
				|  |  | +                                                          size_t nops,
 | 
	
		
			
				|  |  | +                                                          void *tag,
 | 
	
		
			
				|  |  | +                                                          void *reserved) {
 | 
	
		
			
				|  |  | +  return grpc_call_start_batch(call, ops, nops, tag, reserved);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static grpcsharp_call_start_batch_func g_call_start_batch_func =
 | 
	
		
			
				|  |  | +    grpcsharp_call_start_batch_default;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static grpc_call_error grpcsharp_call_start_batch(grpc_call *call,
 | 
	
		
			
				|  |  | +                                                  const grpc_op *ops,
 | 
	
		
			
				|  |  | +                                                  size_t nops, void *tag,
 | 
	
		
			
				|  |  | +                                                  void *reserved) {
 | 
	
		
			
				|  |  | +  return g_call_start_batch_func(call, ops, nops, tag, reserved);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(
 | 
	
		
			
				|  |  |      grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer,
 | 
	
		
			
				|  |  |      size_t send_buffer_len, uint32_t write_flags,
 | 
	
	
		
			
				|  | @@ -576,8 +608,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(
 | 
	
		
			
				|  |  |    ops[5].flags = 0;
 | 
	
		
			
				|  |  |    ops[5].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(
 | 
	
	
		
			
				|  | @@ -616,8 +648,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(
 | 
	
		
			
				|  |  |    ops[3].flags = 0;
 | 
	
		
			
				|  |  |    ops[3].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(
 | 
	
	
		
			
				|  | @@ -656,8 +688,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(
 | 
	
		
			
				|  |  |    ops[3].flags = 0;
 | 
	
		
			
				|  |  |    ops[3].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(
 | 
	
	
		
			
				|  | @@ -685,8 +717,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(
 | 
	
		
			
				|  |  |    ops[1].flags = 0;
 | 
	
		
			
				|  |  |    ops[1].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata(
 | 
	
	
		
			
				|  | @@ -699,8 +731,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata(
 | 
	
		
			
				|  |  |    ops[0].flags = 0;
 | 
	
		
			
				|  |  |    ops[0].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(
 | 
	
	
		
			
				|  | @@ -720,7 +752,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(
 | 
	
		
			
				|  |  |    ops[1].flags = 0;
 | 
	
		
			
				|  |  |    ops[1].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, nops, ctx, NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, nops, ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(
 | 
	
	
		
			
				|  | @@ -731,8 +763,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(
 | 
	
		
			
				|  |  |    ops[0].flags = 0;
 | 
	
		
			
				|  |  |    ops[0].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(
 | 
	
	
		
			
				|  | @@ -773,7 +805,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(
 | 
	
		
			
				|  |  |      ops[nops].reserved = NULL;
 | 
	
		
			
				|  |  |      nops++;
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, nops, ctx, NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, nops, ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE
 | 
	
	
		
			
				|  | @@ -784,8 +816,8 @@ grpcsharp_call_recv_message(grpc_call *call, grpcsharp_batch_context *ctx) {
 | 
	
		
			
				|  |  |    ops[0].data.recv_message.recv_message = &(ctx->recv_message);
 | 
	
		
			
				|  |  |    ops[0].flags = 0;
 | 
	
		
			
				|  |  |    ops[0].reserved = NULL;
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE
 | 
	
	
		
			
				|  | @@ -798,8 +830,8 @@ grpcsharp_call_start_serverside(grpc_call *call, grpcsharp_batch_context *ctx) {
 | 
	
		
			
				|  |  |    ops[0].flags = 0;
 | 
	
		
			
				|  |  |    ops[0].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_initial_metadata(
 | 
	
	
		
			
				|  | @@ -817,8 +849,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_initial_metadata(
 | 
	
		
			
				|  |  |    ops[0].flags = 0;
 | 
	
		
			
				|  |  |    ops[0].reserved = NULL;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx,
 | 
	
		
			
				|  |  | -                               NULL);
 | 
	
		
			
				|  |  | +  return grpcsharp_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]),
 | 
	
		
			
				|  |  | +                                    ctx, NULL);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  GPR_EXPORT grpc_call_error GPR_CALLTYPE
 | 
	
	
		
			
				|  | @@ -1092,3 +1124,17 @@ GPR_EXPORT void *GPR_CALLTYPE grpcsharp_test_nop(void *ptr) { return ptr; }
 | 
	
		
			
				|  |  |  GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_sizeof_grpc_event(void) {
 | 
	
		
			
				|  |  |    return sizeof(grpc_event);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Override a method for testing */
 | 
	
		
			
				|  |  | +GPR_EXPORT void GPR_CALLTYPE
 | 
	
		
			
				|  |  | +grpcsharp_test_override_method(const char *method_name, const char *variant) {
 | 
	
		
			
				|  |  | +  if (strcmp("grpcsharp_call_start_batch", method_name) == 0) {
 | 
	
		
			
				|  |  | +    if (strcmp("nop", variant) == 0) {
 | 
	
		
			
				|  |  | +      g_call_start_batch_func = grpcsharp_call_start_batch_nop;
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +      GPR_ASSERT(0);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  } else {
 | 
	
		
			
				|  |  | +    GPR_ASSERT(0);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 |