Added changes to c++ and ruby wrappers

pull/2054/head
David Garcia Quintas 10 years ago
parent 1d5aca5de0
commit de52625ae5
  1. 14
      src/core/surface/call.c
  2. 8
      src/cpp/common/call.cc
  3. 1
      src/ruby/ext/grpc/rb_call.c

@ -1226,7 +1226,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
switch (op->op) { switch (op->op) {
case GRPC_OP_SEND_INITIAL_METADATA: case GRPC_OP_SEND_INITIAL_METADATA:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
req = &reqs[out++]; req = &reqs[out++];
req->op = GRPC_IOREQ_SEND_INITIAL_METADATA; req->op = GRPC_IOREQ_SEND_INITIAL_METADATA;
req->data.send_metadata.count = op->data.send_initial_metadata.count; req->data.send_metadata.count = op->data.send_initial_metadata.count;
@ -1245,7 +1245,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_SEND_CLOSE_FROM_CLIENT: case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
if (!call->is_client) { if (!call->is_client) {
return GRPC_CALL_ERROR_NOT_ON_SERVER; return GRPC_CALL_ERROR_NOT_ON_SERVER;
} }
@ -1255,7 +1255,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_SEND_STATUS_FROM_SERVER: case GRPC_OP_SEND_STATUS_FROM_SERVER:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
if (call->is_client) { if (call->is_client) {
return GRPC_CALL_ERROR_NOT_ON_CLIENT; return GRPC_CALL_ERROR_NOT_ON_CLIENT;
} }
@ -1276,7 +1276,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_RECV_INITIAL_METADATA: case GRPC_OP_RECV_INITIAL_METADATA:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
if (!call->is_client) { if (!call->is_client) {
return GRPC_CALL_ERROR_NOT_ON_SERVER; return GRPC_CALL_ERROR_NOT_ON_SERVER;
} }
@ -1287,7 +1287,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_RECV_MESSAGE: case GRPC_OP_RECV_MESSAGE:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
req = &reqs[out++]; req = &reqs[out++];
req->op = GRPC_IOREQ_RECV_MESSAGE; req->op = GRPC_IOREQ_RECV_MESSAGE;
req->data.recv_message = op->data.recv_message; req->data.recv_message = op->data.recv_message;
@ -1295,7 +1295,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_RECV_STATUS_ON_CLIENT: case GRPC_OP_RECV_STATUS_ON_CLIENT:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
if (!call->is_client) { if (!call->is_client) {
return GRPC_CALL_ERROR_NOT_ON_SERVER; return GRPC_CALL_ERROR_NOT_ON_SERVER;
} }
@ -1320,7 +1320,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
break; break;
case GRPC_OP_RECV_CLOSE_ON_SERVER: case GRPC_OP_RECV_CLOSE_ON_SERVER:
/* Flag validation: currently allow no flags */ /* Flag validation: currently allow no flags */
if (op->flags) return GRPC_CALL_ERROR_INVALID_FLAGS; if (op->flags != 0) return GRPC_CALL_ERROR_INVALID_FLAGS;
req = &reqs[out++]; req = &reqs[out++];
req->op = GRPC_IOREQ_RECV_STATUS; req->op = GRPC_IOREQ_RECV_STATUS;
req->flags = op->flags; req->flags = op->flags;

@ -224,11 +224,13 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) {
ops[*nops].op = GRPC_OP_SEND_INITIAL_METADATA; ops[*nops].op = GRPC_OP_SEND_INITIAL_METADATA;
ops[*nops].data.send_initial_metadata.count = initial_metadata_count_; ops[*nops].data.send_initial_metadata.count = initial_metadata_count_;
ops[*nops].data.send_initial_metadata.metadata = initial_metadata_; ops[*nops].data.send_initial_metadata.metadata = initial_metadata_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (recv_initial_metadata_) { if (recv_initial_metadata_) {
ops[*nops].op = GRPC_OP_RECV_INITIAL_METADATA; ops[*nops].op = GRPC_OP_RECV_INITIAL_METADATA;
ops[*nops].data.recv_initial_metadata = &recv_initial_metadata_arr_; ops[*nops].data.recv_initial_metadata = &recv_initial_metadata_arr_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (send_message_ || send_message_buffer_) { if (send_message_ || send_message_buffer_) {
@ -245,15 +247,18 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) {
} }
ops[*nops].op = GRPC_OP_SEND_MESSAGE; ops[*nops].op = GRPC_OP_SEND_MESSAGE;
ops[*nops].data.send_message = send_buf_; ops[*nops].data.send_message = send_buf_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (recv_message_ || recv_message_buffer_) { if (recv_message_ || recv_message_buffer_) {
ops[*nops].op = GRPC_OP_RECV_MESSAGE; ops[*nops].op = GRPC_OP_RECV_MESSAGE;
ops[*nops].data.recv_message = &recv_buf_; ops[*nops].data.recv_message = &recv_buf_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (client_send_close_) { if (client_send_close_) {
ops[*nops].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; ops[*nops].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (recv_status_) { if (recv_status_) {
@ -264,6 +269,7 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) {
ops[*nops].data.recv_status_on_client.status_details = &status_details_; ops[*nops].data.recv_status_on_client.status_details = &status_details_;
ops[*nops].data.recv_status_on_client.status_details_capacity = ops[*nops].data.recv_status_on_client.status_details_capacity =
&status_details_capacity_; &status_details_capacity_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (send_status_available_) { if (send_status_available_) {
@ -275,11 +281,13 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) {
ops[*nops].data.send_status_from_server.status = send_status_code_; ops[*nops].data.send_status_from_server.status = send_status_code_;
ops[*nops].data.send_status_from_server.status_details = ops[*nops].data.send_status_from_server.status_details =
send_status_details_.empty() ? nullptr : send_status_details_.c_str(); send_status_details_.empty() ? nullptr : send_status_details_.c_str();
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
if (recv_closed_) { if (recv_closed_) {
ops[*nops].op = GRPC_OP_RECV_CLOSE_ON_SERVER; ops[*nops].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
ops[*nops].data.recv_close_on_server.cancelled = &cancelled_buf_; ops[*nops].data.recv_close_on_server.cancelled = &cancelled_buf_;
ops[*nops].flags = 0;
(*nops)++; (*nops)++;
} }
} }

@ -507,6 +507,7 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack *st, VALUE ops_hash) {
NUM2INT(this_op)); NUM2INT(this_op));
}; };
st->ops[st->op_num].op = (grpc_op_type)NUM2INT(this_op); st->ops[st->op_num].op = (grpc_op_type)NUM2INT(this_op);
st->ops[st->op_num].flags = 0;
st->op_num++; st->op_num++;
} }
} }

Loading…
Cancel
Save