Merge pull request #17628 from muxi/fix-cronet

Cronet batch fixes
pull/17690/head
Muxi Yan 6 years ago committed by GitHub
commit b28be3a835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/core/ext/transport/cronet/transport/cronet_transport.cc

@ -335,6 +335,9 @@ static void add_to_storage(struct stream_obj* s,
/* add new op at the beginning of the linked list. The memory is freed
in remove_from_storage */
op_and_state* new_op = grpc_core::New<op_and_state>(s, *op);
// Pontential fix to crash on GPR_ASSERT(!curr->done)
// TODO (mxyan): check if this is indeed necessary.
new_op->done = false;
gpr_mu_lock(&s->mu);
storage->head = new_op;
storage->num_pending_ops++;
@ -391,7 +394,7 @@ static void execute_from_storage(stream_obj* s) {
gpr_mu_lock(&s->mu);
for (struct op_and_state* curr = s->storage.head; curr != nullptr;) {
CRONET_LOG(GPR_DEBUG, "calling op at %p. done = %d", curr, curr->done);
GPR_ASSERT(curr->done == 0);
GPR_ASSERT(!curr->done);
enum e_op_result result = execute_stream_op(curr);
CRONET_LOG(GPR_DEBUG, "execute_stream_op[%p] returns %s", curr,
op_result_string(result));
@ -400,13 +403,12 @@ static void execute_from_storage(stream_obj* s) {
struct op_and_state* next = curr->next;
remove_from_storage(s, curr);
curr = next;
}
/* continue processing the same op if ACTION_TAKEN_WITHOUT_CALLBACK */
if (result == NO_ACTION_POSSIBLE) {
} else if (result == NO_ACTION_POSSIBLE) {
curr = curr->next;
} else if (result == ACTION_TAKEN_WITH_CALLBACK) {
/* wait for the callback */
break;
}
} /* continue processing the same op if ACTION_TAKEN_WITHOUT_CALLBACK */
}
gpr_mu_unlock(&s->mu);
}

Loading…
Cancel
Save