Ejemplo n.º 1
0
void grpc_chttp2_terminate_writing(grpc_exec_ctx *exec_ctx,
                                   void *transport_writing_ptr, int success) {
  grpc_chttp2_transport_writing *transport_writing = transport_writing_ptr;
  grpc_chttp2_transport *t = TRANSPORT_FROM_WRITING(transport_writing);

  lock(t);

  allow_endpoint_shutdown_locked(exec_ctx, t);

  if (!success) {
    drop_connection(exec_ctx, t);
  }

  /* cleanup writing related jazz */
  grpc_chttp2_cleanup_writing(exec_ctx, &t->global, &t->writing);

  /* leave the writing flag up on shutdown to prevent further writes in unlock()
     from starting */
  t->writing_active = 0;
  if (t->ep && !t->endpoint_reading) {
    destroy_endpoint(exec_ctx, t);
  }

  unlock(exec_ctx, t);

  UNREF_TRANSPORT(exec_ctx, t, "writing");
}
Ejemplo n.º 2
0
static void close_transport_locked(grpc_chttp2_transport *t) {
  if (!t->closed) {
    t->closed = 1;
    connectivity_state_set(&t->global, GRPC_CHANNEL_FATAL_FAILURE,
                           "close_transport");
    if (t->ep) {
      allow_endpoint_shutdown_locked(t);
    }
  }
}