|
|
|
@ -63,6 +63,7 @@ |
|
|
|
|
#include "src/core/lib/channel/channel_args.h" |
|
|
|
|
#include "src/core/lib/debug/stats.h" |
|
|
|
|
#include "src/core/lib/debug/stats_data.h" |
|
|
|
|
#include "src/core/lib/experiments/experiments.h" |
|
|
|
|
#include "src/core/lib/gpr/useful.h" |
|
|
|
|
#include "src/core/lib/gprpp/bitset.h" |
|
|
|
|
#include "src/core/lib/gprpp/crash.h" |
|
|
|
@ -75,6 +76,7 @@ |
|
|
|
|
#include "src/core/lib/iomgr/error.h" |
|
|
|
|
#include "src/core/lib/iomgr/exec_ctx.h" |
|
|
|
|
#include "src/core/lib/iomgr/iomgr_fwd.h" |
|
|
|
|
#include "src/core/lib/iomgr/port.h" |
|
|
|
|
#include "src/core/lib/iomgr/timer.h" |
|
|
|
|
#include "src/core/lib/promise/poll.h" |
|
|
|
|
#include "src/core/lib/resource_quota/arena.h" |
|
|
|
@ -93,6 +95,10 @@ |
|
|
|
|
#include "src/core/lib/transport/transport.h" |
|
|
|
|
#include "src/core/lib/transport/transport_impl.h" |
|
|
|
|
|
|
|
|
|
#ifdef GRPC_POSIX_SOCKET_TCP |
|
|
|
|
#include "src/core/lib/iomgr/ev_posix.h" |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024) |
|
|
|
|
#define MAX_WINDOW 0x7fffffffu |
|
|
|
|
#define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024) |
|
|
|
@ -569,6 +575,14 @@ grpc_chttp2_transport::grpc_chttp2_transport( |
|
|
|
|
if (grpc_core::test_only_init_callback != nullptr) { |
|
|
|
|
grpc_core::test_only_init_callback(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef GRPC_POSIX_SOCKET_TCP |
|
|
|
|
closure_barrier_may_cover_write = |
|
|
|
|
grpc_event_engine_run_in_background() && |
|
|
|
|
grpc_core::IsScheduleCancellationOverWriteEnabled() |
|
|
|
|
? 0 |
|
|
|
|
: CLOSURE_BARRIER_MAY_COVER_WRITE; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) { |
|
|
|
@ -1156,14 +1170,6 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Flag that this closure barrier may be covering a write in a pollset, and so
|
|
|
|
|
// we should not complete this closure until we can prove that the write got
|
|
|
|
|
// scheduled
|
|
|
|
|
#define CLOSURE_BARRIER_MAY_COVER_WRITE (1 << 0) |
|
|
|
|
// First bit of the reference count, stored in the high order bits (with the low
|
|
|
|
|
// bits being used for flags defined above)
|
|
|
|
|
#define CLOSURE_BARRIER_FIRST_REF_BIT (1 << 16) |
|
|
|
|
|
|
|
|
|
static grpc_closure* add_closure_barrier(grpc_closure* closure) { |
|
|
|
|
closure->next_data.scratch += CLOSURE_BARRIER_FIRST_REF_BIT; |
|
|
|
|
return closure; |
|
|
|
@ -1295,7 +1301,7 @@ static void perform_stream_op_locked(void* stream_op, |
|
|
|
|
t->channelz_socket->RecordStreamStartedFromLocal(); |
|
|
|
|
} |
|
|
|
|
GPR_ASSERT(s->send_initial_metadata_finished == nullptr); |
|
|
|
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE; |
|
|
|
|
on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; |
|
|
|
|
|
|
|
|
|
s->send_initial_metadata_finished = add_closure_barrier(on_complete); |
|
|
|
|
s->send_initial_metadata = |
|
|
|
@ -1351,7 +1357,7 @@ static void perform_stream_op_locked(void* stream_op, |
|
|
|
|
t->num_messages_in_next_write++; |
|
|
|
|
grpc_core::global_stats().IncrementHttp2SendMessageSize( |
|
|
|
|
op->payload->send_message.send_message->Length()); |
|
|
|
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE; |
|
|
|
|
on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; |
|
|
|
|
s->send_message_finished = add_closure_barrier(op->on_complete); |
|
|
|
|
const uint32_t flags = op_payload->send_message.flags; |
|
|
|
|
if (s->write_closed) { |
|
|
|
@ -1425,7 +1431,7 @@ static void perform_stream_op_locked(void* stream_op, |
|
|
|
|
|
|
|
|
|
if (op->send_trailing_metadata) { |
|
|
|
|
GPR_ASSERT(s->send_trailing_metadata_finished == nullptr); |
|
|
|
|
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE; |
|
|
|
|
on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; |
|
|
|
|
s->send_trailing_metadata_finished = add_closure_barrier(on_complete); |
|
|
|
|
s->send_trailing_metadata = |
|
|
|
|
op_payload->send_trailing_metadata.send_trailing_metadata; |
|
|
|
|