Пример #1
0
static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, bool success) {
    grpc_call_element *elem = elemp;
    call_data *calld = elem->call_data;
    gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
    if (calld->send_length == calld->slices.length) {
        finish_send_message(exec_ctx, elem);
    } else {
        continue_send_message(exec_ctx, elem);
    }
}
Пример #2
0
static void continue_send_message(grpc_exec_ctx *exec_ctx,
                                  grpc_call_element *elem) {
    call_data *calld = elem->call_data;
    while (grpc_byte_stream_next(exec_ctx, calld->send_op.send_message,
                                 &calld->incoming_slice, ~(size_t)0,
                                 &calld->got_slice)) {
        gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
        if (calld->send_length == calld->slices.length) {
            finish_send_message(exec_ctx, elem);
            break;
        }
    }
}
Пример #3
0
static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
  grpc_call_element *elem = elemp;
  call_data *calld = elem->call_data;
  if (GRPC_ERROR_NONE !=
      grpc_byte_stream_pull(exec_ctx,
                            calld->send_op->payload->send_message.send_message,
                            &calld->incoming_slice)) {
    /* Should never reach here */
    abort();
  }
  grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
  if (calld->send_length == calld->slices.length) {
    finish_send_message(exec_ctx, elem);
  } else {
    continue_send_message(exec_ctx, elem);
  }
}