chttp2_transport.cc
Go to the documentation of this file.
1 //
2 // Copyright 2018 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
18 
20 
21 #include <inttypes.h>
22 #include <limits.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 
27 #include <algorithm>
28 #include <memory>
29 #include <new>
30 #include <string>
31 #include <utility>
32 
33 #include "absl/base/attributes.h"
34 #include "absl/status/status.h"
35 #include "absl/strings/cord.h"
36 #include "absl/strings/str_cat.h"
37 #include "absl/strings/str_format.h"
38 #include "absl/strings/string_view.h"
39 #include "absl/types/optional.h"
40 #include "absl/types/variant.h"
41 
43 #include <grpc/slice_buffer.h>
44 #include <grpc/status.h>
45 #include <grpc/support/alloc.h>
46 #include <grpc/support/atm.h>
47 #include <grpc/support/log.h>
48 
95 
97  grpc_experimental_enable_peer_state_based_framing, false,
98  "If set, the max sizes of frames sent to lower layers is controlled based "
99  "on the peer's memory pressure which is reflected in its max http2 frame "
100  "size.");
101 
102 #define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
103 #define MAX_WINDOW 0x7fffffffu
104 #define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024)
105 #define DEFAULT_MAX_HEADER_LIST_SIZE (8 * 1024)
106 
107 #define DEFAULT_CLIENT_KEEPALIVE_TIME_MS INT_MAX
108 #define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS 20000 /* 20 seconds */
109 #define DEFAULT_SERVER_KEEPALIVE_TIME_MS 7200000 /* 2 hours */
110 #define DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS 20000 /* 20 seconds */
111 #define DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS false
112 #define KEEPALIVE_TIME_BACKOFF_MULTIPLIER 2
113 
114 #define DEFAULT_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS 300000 /* 5 minutes */
115 #define DEFAULT_MAX_PINGS_BETWEEN_DATA 2
116 #define DEFAULT_MAX_PING_STRIKES 2
117 
118 #define DEFAULT_MAX_PENDING_INDUCED_FRAMES 10000
119 
132 
137 
138 #define MAX_CLIENT_STREAM_ID 0x7fffffffu
140 grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive");
142  "chttp2_refcount");
143 
144 // forward declarations of various callbacks that we'll build closures around
146 static void write_action(void* t, grpc_error_handle error);
147 static void write_action_end(void* t, grpc_error_handle error);
148 static void write_action_end_locked(void* t, grpc_error_handle error);
149 
150 static void read_action(void* t, grpc_error_handle error);
151 static void read_action_locked(void* t, grpc_error_handle error);
153 
154 // Set a transport level setting, and push it to our peer
157 
160 
161 // Start new streams that have been created if we can
163 
166  const absl::Status& status,
167  const char* reason);
168 
171 
174 
179 
180 static void start_bdp_ping(void* tp, grpc_error_handle error);
181 static void finish_bdp_ping(void* tp, grpc_error_handle error);
182 static void start_bdp_ping_locked(void* tp, grpc_error_handle error);
183 static void finish_bdp_ping_locked(void* tp, grpc_error_handle error);
185 static void next_bdp_ping_timer_expired_locked(void* tp,
187 
190  grpc_closure* on_initiate, grpc_closure* on_ack);
191 static void retry_initiate_ping_locked(void* tp, grpc_error_handle error);
192 
193 // keepalive-relevant functions
194 static void init_keepalive_ping(void* arg, grpc_error_handle error);
196 static void start_keepalive_ping(void* arg, grpc_error_handle error);
202 
203 namespace grpc_core {
204 
205 namespace {
206 TestOnlyGlobalHttp2TransportInitCallback test_only_init_callback = nullptr;
207 TestOnlyGlobalHttp2TransportDestructCallback test_only_destruct_callback =
208  nullptr;
209 bool test_only_disable_transient_failure_state_notification = false;
210 } // namespace
211 
214  test_only_init_callback = callback;
215 }
216 
219  test_only_destruct_callback = callback;
220 }
221 
223  bool disable) {
224  test_only_disable_transient_failure_state_notification = disable;
225 }
226 
227 } // namespace grpc_core
228 
229 //
230 // CONSTRUCTION/DESTRUCTION/REFCOUNTING
231 //
232 
234  size_t i;
235 
236  if (channelz_socket != nullptr) {
238  }
239 
241 
243 
245 
247  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed");
248  // ContextList::Execute follows semantics of a callback function and does not
249  // take a ref on error
252  cl = nullptr;
253 
256 
257  for (i = 0; i < STREAM_LIST_COUNT; i++) {
258  GPR_ASSERT(lists[i].head == nullptr);
259  GPR_ASSERT(lists[i].tail == nullptr);
260  }
261 
263 
265 
267 
268  GRPC_COMBINER_UNREF(combiner, "chttp2_transport");
269 
270  cancel_pings(this,
271  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
272 
273  while (write_cb_pool) {
277  }
278 
281  if (grpc_core::test_only_destruct_callback != nullptr) {
282  grpc_core::test_only_destruct_callback();
283  }
284 }
285 
286 static const grpc_transport_vtable* get_vtable(void);
287 
289  const grpc_channel_args* channel_args,
290  bool is_client) {
291  bool channelz_enabled = GRPC_ENABLE_CHANNELZ_DEFAULT;
292  size_t i;
293  int j;
294 
295  for (i = 0; i < channel_args->num_args; i++) {
296  if (0 == strcmp(channel_args->args[i].key,
298  const grpc_integer_options options = {-1, 0, INT_MAX};
299  const int value =
300  grpc_channel_arg_get_integer(&channel_args->args[i], options);
301  if (value >= 0) {
302  if ((t->next_stream_id & 1) != (value & 1)) {
303  gpr_log(GPR_ERROR, "%s: low bit must be %d on %s",
304  GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER, t->next_stream_id & 1,
305  is_client ? "client" : "server");
306  } else {
307  t->next_stream_id = static_cast<uint32_t>(value);
308  }
309  }
310  } else if (0 == strcmp(channel_args->args[i].key,
312  const grpc_integer_options options = {-1, 0, INT_MAX};
313  const int value =
314  grpc_channel_arg_get_integer(&channel_args->args[i], options);
315  if (value >= 0) {
316  t->hpack_compressor.SetMaxUsableSize(value);
317  }
318  } else if (0 == strcmp(channel_args->args[i].key,
320  t->ping_policy.max_pings_without_data = grpc_channel_arg_get_integer(
321  &channel_args->args[i],
322  {g_default_max_pings_without_data, 0, INT_MAX});
323  } else if (0 == strcmp(channel_args->args[i].key,
325  t->ping_policy.max_ping_strikes = grpc_channel_arg_get_integer(
326  &channel_args->args[i], {g_default_max_ping_strikes, 0, INT_MAX});
327  } else if (0 ==
328  strcmp(channel_args->args[i].key,
330  t->ping_policy.min_recv_ping_interval_without_data =
332  &channel_args->args[i],
334  g_default_min_recv_ping_interval_without_data_ms, 0,
335  INT_MAX}));
336  } else if (0 == strcmp(channel_args->args[i].key,
338  t->write_buffer_size = static_cast<uint32_t>(grpc_channel_arg_get_integer(
339  &channel_args->args[i], {0, 0, MAX_WRITE_BUFFER_SIZE}));
340  } else if (0 ==
341  strcmp(channel_args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
343  &channel_args->args[i],
344  grpc_integer_options{t->is_client
345  ? g_default_client_keepalive_time_ms
346  : g_default_server_keepalive_time_ms,
347  1, INT_MAX});
348  t->keepalive_time = value == INT_MAX
351  } else if (0 == strcmp(channel_args->args[i].key,
354  &channel_args->args[i],
355  grpc_integer_options{t->is_client
356  ? g_default_client_keepalive_timeout_ms
357  : g_default_server_keepalive_timeout_ms,
358  0, INT_MAX});
359  t->keepalive_timeout = value == INT_MAX
362  } else if (0 == strcmp(channel_args->args[i].key,
364  t->keepalive_permit_without_calls = static_cast<uint32_t>(
365  grpc_channel_arg_get_integer(&channel_args->args[i], {0, 0, 1}));
366  } else if (0 == strcmp(channel_args->args[i].key,
368  gpr_log(GPR_INFO, "GRPC_ARG_OPTIMIZATION_TARGET is deprecated");
369  } else if (0 ==
370  strcmp(channel_args->args[i].key, GRPC_ARG_ENABLE_CHANNELZ)) {
371  channelz_enabled = grpc_channel_arg_get_bool(
372  &channel_args->args[i], GRPC_ENABLE_CHANNELZ_DEFAULT);
373  } else {
374  static const struct {
375  const char* channel_arg_name;
376  grpc_chttp2_setting_id setting_id;
377  grpc_integer_options integer_options;
378  bool availability[2] /* server, client */;
379  } settings_map[] = {{GRPC_ARG_MAX_CONCURRENT_STREAMS,
381  {-1, 0, INT32_MAX},
382  {true, false}},
385  {-1, 0, INT32_MAX},
386  {true, true}},
389  {-1, 0, INT32_MAX},
390  {true, true}},
393  {-1, 16384, 16777215},
394  {true, true}},
397  {1, 0, 1},
398  {true, true}},
401  {-1, 5, INT32_MAX},
402  {true, true}}};
403  for (j = 0; j < static_cast<int> GPR_ARRAY_SIZE(settings_map); j++) {
404  if (0 == strcmp(channel_args->args[i].key,
405  settings_map[j].channel_arg_name)) {
406  if (!settings_map[j].availability[is_client]) {
407  gpr_log(GPR_DEBUG, "%s is not available on %s",
408  settings_map[j].channel_arg_name,
409  is_client ? "clients" : "servers");
410  } else {
412  &channel_args->args[i], settings_map[j].integer_options);
413  if (value >= 0) {
414  queue_setting_update(t, settings_map[j].setting_id,
415  static_cast<uint32_t>(value));
416  }
417  }
418  break;
419  }
420  }
421  }
422  }
423  if (channelz_enabled) {
424  t->channelz_socket =
425  grpc_core::MakeRefCounted<grpc_core::channelz::SocketNode>(
426  std::string(grpc_endpoint_get_local_address(t->ep)), t->peer_string,
427  absl::StrFormat("%s %s", get_vtable()->name, t->peer_string),
429  channel_args));
430  }
431 }
432 
434  if (t->is_client) {
435  t->keepalive_time = g_default_client_keepalive_time_ms == INT_MAX
439  t->keepalive_timeout = g_default_client_keepalive_timeout_ms == INT_MAX
443  t->keepalive_permit_without_calls =
445  } else {
446  t->keepalive_time = g_default_server_keepalive_time_ms == INT_MAX
450  t->keepalive_timeout = g_default_server_keepalive_timeout_ms == INT_MAX
454  t->keepalive_permit_without_calls =
456  }
457 }
458 
460  t->ping_policy.max_pings_without_data = g_default_max_pings_without_data;
461  t->ping_policy.max_ping_strikes = g_default_max_ping_strikes;
462  t->ping_policy.min_recv_ping_interval_without_data =
465 }
466 
468  if (t->keepalive_time != grpc_core::Duration::Infinity()) {
469  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
470  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
471  GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
472  grpc_schedule_on_exec_ctx);
473  grpc_timer_init(&t->keepalive_ping_timer,
474  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
475  &t->init_keepalive_ping_locked);
476  } else {
477  // Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
478  // inflight keeaplive timers
479  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED;
480  }
481 }
482 
484  const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client)
486  ? "chttp2_refcount"
487  : nullptr),
488  ep(ep),
489  peer_string(grpc_endpoint_get_peer(ep)),
490  memory_owner(grpc_core::ResourceQuotaFromChannelArgs(channel_args)
491  ->memory_quota()
492  ->CreateMemoryOwner(absl::StrCat(
493  grpc_endpoint_get_peer(ep), ":client_transport"))),
494  self_reservation(
495  memory_owner.MakeReservation(sizeof(grpc_chttp2_transport))),
496  combiner(grpc_combiner_create()),
497  state_tracker(is_client ? "client_transport" : "server_transport",
499  is_client(is_client),
500  next_stream_id(is_client ? 1 : 2),
501  flow_control(peer_string.c_str(),
502  grpc_channel_args_find_bool(channel_args,
504  &memory_owner),
505  deframe_state(is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0) {
508  base.vtable = get_vtable();
509  // 8 is a random stab in the dark as to a good initial size: it's small enough
510  // that it shouldn't waste memory for infrequently used connections, yet
511  // large enough that the exponential growth should happen nicely when it's
512  // needed.
513  // TODO(ctiller): tune this
515 
518  if (is_client) {
521  }
523  // copy in initial settings to all setting sets
524  size_t i;
525  int j;
526  for (i = 0; i < GRPC_CHTTP2_NUM_SETTINGS; i++) {
527  for (j = 0; j < GRPC_NUM_SETTING_SETS; j++) {
529  }
530  }
532 
533  // configure http2 the way we like it
534  if (is_client) {
537  }
542 
545 
546  if (channel_args != nullptr) {
547  read_channel_args(this, channel_args, is_client);
548  }
549 
550  // No pings allowed before receiving a header or data frame.
554 
557 
559 
560  if (flow_control.bdp_probe()) {
561  bdp_ping_blocked = true;
563  nullptr);
564  }
565 
567  post_benign_reclaimer(this);
568  if (grpc_core::test_only_init_callback != nullptr) {
569  grpc_core::test_only_init_callback();
570  }
571 }
572 
573 static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) {
574  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
575  t->destroying = 1;
578  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"),
579  GRPC_ERROR_INT_OCCURRED_DURING_WRITE, t->write_state));
580  t->memory_owner.Reset();
581  // Must be the last line.
582  GRPC_CHTTP2_UNREF_TRANSPORT(t, "destroy");
583 }
584 
586  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
587  t->combiner->Run(GRPC_CLOSURE_CREATE(destroy_transport_locked, t, nullptr),
589 }
590 
595  if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
599  }
600  if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
601  if (GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
602  t->close_transport_on_writes_finished =
604  "Delayed close due to in-progress write");
605  }
606  t->close_transport_on_writes_finished =
607  grpc_error_add_child(t->close_transport_on_writes_finished, error);
608  return;
609  }
611  t->closed_with_error = GRPC_ERROR_REF(error);
613  "close_transport");
614  if (t->ping_state.is_delayed_ping_timer_set) {
615  grpc_timer_cancel(&t->ping_state.delayed_ping_timer);
616  }
617  if (t->have_next_bdp_ping_timer) {
618  grpc_timer_cancel(&t->next_bdp_ping_timer);
619  }
620  switch (t->keepalive_state) {
622  grpc_timer_cancel(&t->keepalive_ping_timer);
623  break;
625  grpc_timer_cancel(&t->keepalive_ping_timer);
626  grpc_timer_cancel(&t->keepalive_watchdog_timer);
627  break;
630  // keepalive timers are not set in these two states
631  break;
632  }
633 
634  // flush writable stream list to avoid dangling references
636  while (grpc_chttp2_list_pop_writable_stream(t, &s)) {
637  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:close");
638  }
639  GPR_ASSERT(t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE);
641  }
642  if (t->notify_on_receive_settings != nullptr) {
643  grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_receive_settings,
645  t->notify_on_receive_settings = nullptr;
646  }
647  if (t->notify_on_close != nullptr) {
648  grpc_core::ExecCtx::Run(DEBUG_LOCATION, t->notify_on_close,
650  t->notify_on_close = nullptr;
651  }
653 }
654 
655 #ifndef NDEBUG
656 void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason) {
657  grpc_stream_ref(s->refcount, reason);
658 }
659 void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason) {
660  grpc_stream_unref(s->refcount, reason);
661 }
662 #else
664  grpc_stream_ref(s->refcount);
665 }
667  grpc_stream_unref(s->refcount);
668 }
669 #endif
670 
672  // We reserve one 'active stream' that's dropped when the stream is
673  // read-closed. The others are for Chttp2IncomingByteStreams that are
674  // actively reading
675  GRPC_CHTTP2_STREAM_REF(s, "chttp2");
676  GRPC_CHTTP2_REF_TRANSPORT(s->t, "stream");
677 }
678 
681  const void* server_data,
683  : t(t),
685  reffer(this),
689  if (server_data) {
690  id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
691  *t->accepting_stream = this;
694  }
695 
698 }
699 
703 
704  if (t->channelz_socket != nullptr) {
705  if ((t->is_client && eos_received) || (!t->is_client && eos_sent)) {
707  } else {
709  }
710  }
711 
712  GPR_ASSERT((write_closed && read_closed) || id == 0);
713  if (id != 0) {
715  }
716 
718 
719  for (int i = 0; i < STREAM_LIST_COUNT; i++) {
720  if (GPR_UNLIKELY(included.is_set(i))) {
721  gpr_log(GPR_ERROR, "%s stream %d still included in list %d",
722  t->is_client ? "client" : "server", id, i);
723  abort();
724  }
725  }
726 
730  GPR_ASSERT(recv_message_ready == nullptr);
735  GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
737 }
738 
740  grpc_stream_refcount* refcount, const void* server_data,
742  GPR_TIMER_SCOPE("init_stream", 0);
743  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
744  new (gs) grpc_chttp2_stream(t, refcount, server_data, arena);
745  return 0;
746 }
747 
748 static void destroy_stream_locked(void* sp, grpc_error_handle /*error*/) {
749  GPR_TIMER_SCOPE("destroy_stream", 0);
750  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
751  s->~grpc_chttp2_stream();
752 }
753 
755  grpc_closure* then_schedule_closure) {
756  GPR_TIMER_SCOPE("destroy_stream", 0);
757  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
758  grpc_chttp2_stream* s = reinterpret_cast<grpc_chttp2_stream*>(gs);
759 
760  s->destroy_stream_arg = then_schedule_closure;
761  t->combiner->Run(
762  GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s, nullptr),
764 }
765 
767  uint32_t id) {
768  if (t->accept_stream_cb == nullptr) {
769  return nullptr;
770  }
771  grpc_chttp2_stream* accepting = nullptr;
772  GPR_ASSERT(t->accepting_stream == nullptr);
773  t->accepting_stream = &accepting;
774  t->accept_stream_cb(t->accept_stream_cb_user_data, &t->base,
775  reinterpret_cast<void*>(id));
776  t->accepting_stream = nullptr;
777  return accepting;
778 }
779 
780 //
781 // OUTPUT PROCESSING
782 //
783 
785  switch (st) {
787  return "IDLE";
789  return "WRITING";
791  return "WRITING+MORE";
792  }
793  GPR_UNREACHABLE_CODE(return "UNKNOWN");
794 }
795 
797  grpc_chttp2_write_state st, const char* reason) {
799  gpr_log(GPR_INFO, "W:%p %s [%s] state %s -> %s [%s]", t,
800  t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
801  write_state_name(t->write_state), write_state_name(st), reason));
802  t->write_state = st;
803  // If the state is being reset back to idle, it means a write was just
804  // finished. Make sure all the run_after_write closures are scheduled.
805  //
806  // This is also our chance to close the transport if the transport was marked
807  // to be closed after all writes finish (for example, if we received a go-away
808  // from peer while we had some pending writes)
809  if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
810  grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
811  if (!GRPC_ERROR_IS_NONE(t->close_transport_on_writes_finished)) {
812  grpc_error_handle err = t->close_transport_on_writes_finished;
813  t->close_transport_on_writes_finished = GRPC_ERROR_NONE;
815  }
816  }
817 }
818 
821  switch (reason) {
824  break;
827  break;
830  break;
833  break;
836  break;
839  break;
842  break;
845  break;
848  break;
851  break;
854  break;
857  break;
860  break;
863  break;
866  break;
869  break;
872  break;
875  break;
878  break;
881  break;
884  break;
887  break;
888  }
889 }
890 
893  GPR_TIMER_SCOPE("grpc_chttp2_initiate_write", 0);
894 
895  switch (t->write_state) {
900  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
901  // Note that the 'write_action_begin_locked' closure is being scheduled
902  // on the 'finally_scheduler' of t->combiner. This means that
903  // 'write_action_begin_locked' is called only *after* all the other
904  // closures (some of which are potentially initiating more writes on the
905  // transport) are executed on the t->combiner.
906  //
907  // The reason for scheduling on finally_scheduler is to make sure we batch
908  // as many writes as possible. 'write_action_begin_locked' is the function
909  // that gathers all the relevant bytes (which are at various places in the
910  // grpc_chttp2_transport structure) and append them to 'outbuf' field in
911  // grpc_chttp2_transport thereby batching what would have been potentially
912  // multiple write operations.
913  //
914  // Also, 'write_action_begin_locked' only gathers the bytes into outbuf.
915  // It does not call the endpoint to write the bytes. That is done by the
916  // 'write_action' (which is scheduled by 'write_action_begin_locked')
917  t->combiner->FinallyRun(
918  GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
919  write_action_begin_locked, t, nullptr),
921  break;
925  break;
927  break;
928  }
929 }
930 
932  grpc_chttp2_stream* s) {
933  if (GRPC_ERROR_IS_NONE(t->closed_with_error) &&
935  GRPC_CHTTP2_STREAM_REF(s, "chttp2_writing:become");
936  }
937 }
938 
939 static const char* begin_writing_desc(bool partial) {
940  if (partial) {
941  return "begin partial write in background";
942  } else {
943  return "begin write in current thread";
944  }
945 }
946 
947 static void write_action_begin_locked(void* gt,
948  grpc_error_handle /*error_ignored*/) {
949  GPR_TIMER_SCOPE("write_action_begin_locked", 0);
950  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
951  GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
953  if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
954  r.writing = false;
955  } else {
957  }
958  if (r.writing) {
959  if (r.partial) {
961  }
962  set_write_state(t,
965  begin_writing_desc(r.partial));
967  if (t->reading_paused_on_pending_induced_frames) {
968  GPR_ASSERT(t->num_pending_induced_frames == 0);
969  // We had paused reading, because we had many induced frames (SETTINGS
970  // ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have
971  // been able to flush qbuf, we can resume reading.
973  GPR_INFO,
974  "transport %p : Resuming reading after being paused due to too "
975  "many unwritten SETTINGS ACK, PINGS ACK and RST_STREAM frames",
976  t));
977  t->reading_paused_on_pending_induced_frames = false;
979  }
980  } else {
982  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing");
983  GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
984  }
985 }
986 
987 static void write_action(void* gt, grpc_error_handle /*error*/) {
988  GPR_TIMER_SCOPE("write_action", 0);
989  static bool kEnablePeerStateBasedFraming =
990  GPR_GLOBAL_CONFIG_GET(grpc_experimental_enable_peer_state_based_framing);
991  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
992  void* cl = t->cl;
993  t->cl = nullptr;
994  // If grpc_experimental_enable_peer_state_based_framing is set to true,
995  // choose max_frame_size as 2 * max http2 frame size of peer. If peer is under
996  // high memory pressure, then it would advertise a smaller max http2 frame
997  // size. With this logic, the sender would automatically reduce the sending
998  // frame size as well.
999  int max_frame_size =
1000  kEnablePeerStateBasedFraming
1001  ? 2 * t->settings[GRPC_PEER_SETTINGS]
1003  : INT_MAX;
1005  t->ep, &t->outbuf,
1006  GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end, t,
1007  grpc_schedule_on_exec_ctx),
1008  cl, max_frame_size);
1009 }
1010 
1011 static void write_action_end(void* tp, grpc_error_handle error) {
1012  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
1013  t->combiner->Run(GRPC_CLOSURE_INIT(&t->write_action_end_locked,
1014  write_action_end_locked, t, nullptr),
1016 }
1017 
1018 // Callback from the grpc_endpoint after bytes have been written by calling
1019 // sendmsg
1021  GPR_TIMER_SCOPE("terminate_writing_with_lock", 0);
1022  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
1023 
1024  bool closed = false;
1025  if (!GRPC_ERROR_IS_NONE(error)) {
1027  closed = true;
1028  }
1029 
1030  if (t->sent_goaway_state == GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED) {
1031  t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SENT;
1032  closed = true;
1033  if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
1035  t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
1036  }
1037  }
1038 
1039  switch (t->write_state) {
1041  GPR_UNREACHABLE_CODE(break);
1043  GPR_TIMER_MARK("state=writing", 0);
1044  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "finish writing");
1045  break;
1047  GPR_TIMER_MARK("state=writing_stale_no_poller", 0);
1048  set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing");
1049  GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
1050  // If the transport is closed, we will retry writing on the endpoint
1051  // and next write may contain part of the currently serialized frames.
1052  // So, we should only call the run_after_write callbacks when the next
1053  // write finishes, or the callbacks will be invoked when the stream is
1054  // closed.
1055  if (!closed) {
1056  grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
1057  }
1058  t->combiner->FinallyRun(
1059  GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
1060  write_action_begin_locked, t, nullptr),
1061  GRPC_ERROR_NONE);
1062  break;
1063  }
1064 
1066  GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
1067 }
1068 
1069 // Dirties an HTTP2 setting to be sent out next time a writing path occurs.
1070 // If the change needs to occur immediately, manually initiate a write.
1073  const grpc_chttp2_setting_parameters* sp =
1075  uint32_t use_value = grpc_core::Clamp(value, sp->min_value, sp->max_value);
1076  if (use_value != value) {
1077  gpr_log(GPR_INFO, "Requested parameter %s clamped from %d to %d", sp->name,
1078  value, use_value);
1079  }
1080  if (use_value != t->settings[GRPC_LOCAL_SETTINGS][id]) {
1081  t->settings[GRPC_LOCAL_SETTINGS][id] = use_value;
1082  t->dirtied_local_settings = true;
1083  }
1084 }
1085 
1086 // Cancel out streams that haven't yet started if we have received a GOAWAY
1089  grpc_chttp2_stream* s;
1091  s->trailing_metadata_buffer.Set(
1095  }
1097 }
1098 
1100  uint32_t goaway_error,
1101  uint32_t last_stream_id,
1102  absl::string_view goaway_text) {
1103  // Discard the error from a previous goaway frame (if any)
1104  if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
1105  GRPC_ERROR_UNREF(t->goaway_error);
1106  }
1107  t->goaway_error = grpc_error_set_str(
1110  GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"),
1111  GRPC_ERROR_INT_HTTP2_ERROR, static_cast<intptr_t>(goaway_error)),
1113  GRPC_ERROR_STR_RAW_BYTES, goaway_text);
1114 
1116  gpr_log(GPR_INFO, "transport %p got goaway with last stream id %d", t,
1117  last_stream_id));
1118  // We want to log this irrespective of whether http tracing is enabled if we
1119  // received a GOAWAY with a non NO_ERROR code.
1120  if (goaway_error != GRPC_HTTP2_NO_ERROR) {
1121  gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
1122  goaway_error, grpc_error_std_string(t->goaway_error).c_str());
1123  }
1124  if (t->is_client) {
1125  cancel_unstarted_streams(t, GRPC_ERROR_REF(t->goaway_error));
1126  // Cancel all unseen streams
1128  &t->stream_map,
1129  [](void* user_data, uint32_t /* key */, void* stream) {
1130  uint32_t last_stream_id = *(static_cast<uint32_t*>(user_data));
1131  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(stream);
1132  if (s->id > last_stream_id) {
1133  s->trailing_metadata_buffer.Set(
1134  grpc_core::GrpcStreamNetworkState(),
1135  grpc_core::GrpcStreamNetworkState::kNotSeenByServer);
1136  grpc_chttp2_cancel_stream(s->t, s,
1137  GRPC_ERROR_REF(s->t->goaway_error));
1138  }
1139  },
1140  &last_stream_id);
1141  }
1143  // When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
1144  // data equal to "too_many_pings", it should log the occurrence at a log level
1145  // that is enabled by default and double the configured KEEPALIVE_TIME used
1146  // for new connections on that channel.
1147  if (GPR_UNLIKELY(t->is_client &&
1148  goaway_error == GRPC_HTTP2_ENHANCE_YOUR_CALM &&
1149  goaway_text == "too_many_pings")) {
1151  "Received a GOAWAY with error code ENHANCE_YOUR_CALM and debug "
1152  "data equal to \"too_many_pings\"");
1153  constexpr auto max_keepalive_time = grpc_core::Duration::Milliseconds(
1155  t->keepalive_time =
1156  t->keepalive_time > max_keepalive_time
1158  : t->keepalive_time * KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
1160  absl::Cord(std::to_string(t->keepalive_time.millis())));
1161  }
1162  // lie: use transient failure from the transport to indicate goaway has been
1163  // received.
1164  if (!grpc_core::test_only_disable_transient_failure_state_notification) {
1166  "got_goaway");
1167  }
1168 }
1169 
1171  grpc_chttp2_stream* s;
1172  // maybe cancel out streams that haven't yet started if we have received a
1173  // GOAWAY
1174  if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
1175  cancel_unstarted_streams(t, GRPC_ERROR_REF(t->goaway_error));
1176  return;
1177  }
1178  // start streams where we have free grpc_chttp2_stream ids and free
1179  // * concurrency
1180  while (t->next_stream_id <= MAX_CLIENT_STREAM_ID &&
1181  grpc_chttp2_stream_map_size(&t->stream_map) <
1182  t->settings[GRPC_PEER_SETTINGS]
1185  // safe since we can't (legally) be parsing this stream yet
1187  GPR_INFO,
1188  "HTTP:%s: Transport %p allocating new grpc_chttp2_stream %p to id %d",
1189  t->is_client ? "CLI" : "SVR", t, s, t->next_stream_id));
1190 
1191  GPR_ASSERT(s->id == 0);
1192  s->id = t->next_stream_id;
1193  t->next_stream_id += 2;
1194 
1195  if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
1198  "Transport Stream IDs exhausted"),
1199  "no_more_stream_ids");
1200  }
1201 
1202  grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
1206  }
1207  // cancel out streams that will never be started
1208  if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
1210  s->trailing_metadata_buffer.Set(
1214  t, s,
1216  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
1218  }
1219  }
1220 }
1221 
1222 // Flag that this closure barrier may be covering a write in a pollset, and so
1223 // we should not complete this closure until we can prove that the write got
1224 // scheduled
1225 #define CLOSURE_BARRIER_MAY_COVER_WRITE (1 << 0)
1226 // First bit of the reference count, stored in the high order bits (with the low
1227 // bits being used for flags defined above)
1228 #define CLOSURE_BARRIER_FIRST_REF_BIT (1 << 16)
1229 
1231  closure->next_data.scratch += CLOSURE_BARRIER_FIRST_REF_BIT;
1232  return closure;
1233 }
1234 
1236  grpc_closure* c = *closure;
1237  *closure = nullptr;
1238  // null_then_schedule_closure might be run during a start_batch which might
1239  // subsequently examine the batch for more operations contained within.
1240  // However, the closure run might make it back to the call object, push a
1241  // completion, have the application see it, and make a new operation on the
1242  // call which recycles the batch BEFORE the call to start_batch completes,
1243  // forcing a race.
1245 }
1246 
1248  grpc_chttp2_stream* /*s*/,
1249  grpc_closure** pclosure,
1251  const char* desc) {
1252  grpc_closure* closure = *pclosure;
1253  *pclosure = nullptr;
1254  if (closure == nullptr) {
1256  return;
1257  }
1258  closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT;
1260  gpr_log(
1261  GPR_INFO,
1262  "complete_closure_step: t=%p %p refs=%d flags=0x%04x desc=%s err=%s "
1263  "write_state=%s",
1264  t, closure,
1265  static_cast<int>(closure->next_data.scratch /
1267  static_cast<int>(closure->next_data.scratch %
1270  write_state_name(t->write_state));
1271  }
1272  if (!GRPC_ERROR_IS_NONE(error)) {
1273 #ifdef GRPC_ERROR_IS_ABSEIL_STATUS
1274  grpc_error_handle cl_err =
1276 #else
1277  grpc_error_handle cl_err =
1278  reinterpret_cast<grpc_error_handle>(closure->error_data.error);
1279 #endif
1280  if (GRPC_ERROR_IS_NONE(cl_err)) {
1282  "Error in HTTP transport completing operation");
1284  t->peer_string);
1285  }
1286  cl_err = grpc_error_add_child(cl_err, error);
1287 #ifdef GRPC_ERROR_IS_ABSEIL_STATUS
1288  closure->error_data.error = grpc_core::internal::StatusAllocHeapPtr(cl_err);
1289 #else
1290  closure->error_data.error = reinterpret_cast<intptr_t>(cl_err);
1291 #endif
1292  }
1293  if (closure->next_data.scratch < CLOSURE_BARRIER_FIRST_REF_BIT) {
1294  if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
1295  !(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
1296  // Using GRPC_CLOSURE_SCHED instead of GRPC_CLOSURE_RUN to avoid running
1297  // closures earlier than when it is safe to do so.
1298 #ifdef GRPC_ERROR_IS_ABSEIL_STATUS
1299  grpc_error_handle run_error =
1301 #else
1302  grpc_error_handle run_error =
1303  reinterpret_cast<grpc_error_handle>(closure->error_data.error);
1304 #endif
1305  closure->error_data.error = 0;
1307  } else {
1308  grpc_closure_list_append(&t->run_after_write, closure);
1309  }
1310  }
1311 }
1312 
1314  return batch->get(grpc_core::GrpcStatusMetadata()).value_or(GRPC_STATUS_OK) !=
1316 }
1317 
1318 static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
1319  bool is_client, bool is_initial) {
1321  "HTTP:", id, is_initial ? ":HDR" : ":TRL", is_client ? ":CLI:" : ":SVR:");
1323  gpr_log(GPR_INFO, "%s", absl::StrCat(prefix, key, ": ", value).c_str());
1324  });
1325 }
1326 
1327 static void perform_stream_op_locked(void* stream_op,
1328  grpc_error_handle /*error_ignored*/) {
1329  GPR_TIMER_SCOPE("perform_stream_op_locked", 0);
1330 
1332  static_cast<grpc_transport_stream_op_batch*>(stream_op);
1333  grpc_chttp2_stream* s =
1334  static_cast<grpc_chttp2_stream*>(op->handler_private.extra_arg);
1335  grpc_transport_stream_op_batch_payload* op_payload = op->payload;
1336  grpc_chttp2_transport* t = s->t;
1337 
1339 
1340  s->context = op->payload->context;
1341  s->traced = op->is_traced;
1343  gpr_log(GPR_INFO,
1344  "perform_stream_op_locked[s=%p; op=%p]: %s; on_complete = %p", s,
1346  op->on_complete);
1347  if (op->send_initial_metadata) {
1348  log_metadata(op_payload->send_initial_metadata.send_initial_metadata,
1349  s->id, t->is_client, true);
1350  }
1351  if (op->send_trailing_metadata) {
1352  log_metadata(op_payload->send_trailing_metadata.send_trailing_metadata,
1353  s->id, t->is_client, false);
1354  }
1355  }
1356 
1357  grpc_closure* on_complete = op->on_complete;
1358  // on_complete will be null if and only if there are no send ops in the batch.
1359  if (on_complete != nullptr) {
1360  // This batch has send ops. Use final_data as a barrier until enqueue time;
1361  // the initial counter is dropped at the end of this function.
1363  on_complete->error_data.error = 0;
1364  }
1365 
1366  if (op->cancel_stream) {
1369  }
1370 
1371  if (op->send_initial_metadata) {
1372  if (t->is_client && t->channelz_socket != nullptr) {
1373  t->channelz_socket->RecordStreamStartedFromLocal();
1374  }
1376  GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
1378 
1379  s->send_initial_metadata_finished = add_closure_barrier(on_complete);
1380  s->send_initial_metadata =
1381  op_payload->send_initial_metadata.send_initial_metadata;
1382  if (t->is_client) {
1383  s->deadline = std::min(
1384  s->deadline,
1385  s->send_initial_metadata->get(grpc_core::GrpcTimeoutMetadata())
1386  .value_or(grpc_core::Timestamp::InfFuture()));
1387  }
1388  if (contains_non_ok_status(s->send_initial_metadata)) {
1389  s->seen_error = true;
1390  }
1391  if (!s->write_closed) {
1392  if (t->is_client) {
1393  if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
1394  GPR_ASSERT(s->id == 0);
1397  } else {
1398  s->trailing_metadata_buffer.Set(
1402  t, s,
1405  "Transport closed", &t->closed_with_error, 1),
1407  }
1408  } else {
1409  GPR_ASSERT(s->id != 0);
1411  if (!(op->send_message &&
1412  (op->payload->send_message.flags & GRPC_WRITE_BUFFER_HINT))) {
1415  }
1416  }
1417  } else {
1418  s->send_initial_metadata = nullptr;
1420  t, s, &s->send_initial_metadata_finished,
1422  "Attempt to send initial metadata after stream was closed",
1423  &s->write_closed_error, 1),
1424  "send_initial_metadata_finished");
1425  }
1426  if (op_payload->send_initial_metadata.peer_string != nullptr) {
1427  gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
1428  (gpr_atm)t->peer_string.c_str());
1429  }
1430  }
1431 
1432  if (op->send_message) {
1434  t->num_messages_in_next_write++;
1436  op->payload->send_message.send_message->Length());
1438  s->send_message_finished = add_closure_barrier(op->on_complete);
1439  const uint32_t flags = op_payload->send_message.flags;
1440  if (s->write_closed) {
1441  op->payload->send_message.stream_write_closed = true;
1442  // We should NOT return an error here, so as to avoid a cancel OP being
1443  // started. The surface layer will notice that the stream has been closed
1444  // for writes and fail the send message op.
1445  grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
1447  "fetching_send_message_finished");
1448  } else {
1449  uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(
1450  &s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES);
1451  frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0;
1452  size_t len = op_payload->send_message.send_message->Length();
1453  frame_hdr[1] = static_cast<uint8_t>(len >> 24);
1454  frame_hdr[2] = static_cast<uint8_t>(len >> 16);
1455  frame_hdr[3] = static_cast<uint8_t>(len >> 8);
1456  frame_hdr[4] = static_cast<uint8_t>(len);
1457 
1458  s->next_message_end_offset =
1459  s->flow_controlled_bytes_written +
1460  static_cast<int64_t>(s->flow_controlled_buffer.length) +
1461  static_cast<int64_t>(len);
1462  if (flags & GRPC_WRITE_BUFFER_HINT) {
1463  s->next_message_end_offset -= t->write_buffer_size;
1464  s->write_buffering = true;
1465  } else {
1466  s->write_buffering = false;
1467  }
1468 
1469  grpc_slice* const slices =
1470  op_payload->send_message.send_message->c_slice_buffer()->slices;
1471  grpc_slice* const end =
1472  slices + op_payload->send_message.send_message->Count();
1473  for (grpc_slice* slice = slices; slice != end; slice++) {
1474  grpc_slice_buffer_add(&s->flow_controlled_buffer,
1476  }
1477 
1478  int64_t notify_offset = s->next_message_end_offset;
1479  if (notify_offset <= s->flow_controlled_bytes_written) {
1480  grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
1482  "fetching_send_message_finished");
1483  } else {
1484  grpc_chttp2_write_cb* cb = t->write_cb_pool;
1485  if (cb == nullptr) {
1486  cb = static_cast<grpc_chttp2_write_cb*>(gpr_malloc(sizeof(*cb)));
1487  } else {
1488  t->write_cb_pool = cb->next;
1489  }
1490  cb->call_at_byte = notify_offset;
1491  cb->closure = s->send_message_finished;
1492  s->send_message_finished = nullptr;
1494  ? &s->on_write_finished_cbs
1495  : &s->on_flow_controlled_cbs;
1496  cb->next = *list;
1497  *list = cb;
1498  }
1499 
1500  if (s->id != 0 &&
1501  (!s->write_buffering ||
1502  s->flow_controlled_buffer.length > t->write_buffer_size)) {
1505  }
1506  }
1507  }
1508 
1509  if (op->send_trailing_metadata) {
1511  GPR_ASSERT(s->send_trailing_metadata_finished == nullptr);
1513  s->send_trailing_metadata_finished = add_closure_barrier(on_complete);
1514  s->send_trailing_metadata =
1515  op_payload->send_trailing_metadata.send_trailing_metadata;
1516  s->sent_trailing_metadata_op = op_payload->send_trailing_metadata.sent;
1517  s->write_buffering = false;
1518  if (contains_non_ok_status(s->send_trailing_metadata)) {
1519  s->seen_error = true;
1520  }
1521  if (s->write_closed) {
1522  s->send_trailing_metadata = nullptr;
1523  s->sent_trailing_metadata_op = nullptr;
1525  t, s, &s->send_trailing_metadata_finished,
1526  op->payload->send_trailing_metadata.send_trailing_metadata->empty()
1527  ? GRPC_ERROR_NONE
1529  "Attempt to send trailing metadata after "
1530  "stream was closed"),
1531  "send_trailing_metadata_finished");
1532  } else if (s->id != 0) {
1533  // TODO(ctiller): check if there's flow control for any outstanding
1534  // bytes before going writable
1538  }
1539  }
1540 
1541  if (op->recv_initial_metadata) {
1543  GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
1544  s->recv_initial_metadata_ready =
1545  op_payload->recv_initial_metadata.recv_initial_metadata_ready;
1546  s->recv_initial_metadata =
1547  op_payload->recv_initial_metadata.recv_initial_metadata;
1548  s->trailing_metadata_available =
1549  op_payload->recv_initial_metadata.trailing_metadata_available;
1550  if (op_payload->recv_initial_metadata.peer_string != nullptr) {
1551  gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
1552  (gpr_atm)t->peer_string.c_str());
1553  }
1555  }
1556 
1557  if (op->recv_message) {
1559  GPR_ASSERT(s->recv_message_ready == nullptr);
1560  s->recv_message_ready = op_payload->recv_message.recv_message_ready;
1561  s->recv_message = op_payload->recv_message.recv_message;
1562  s->recv_message->emplace();
1563  s->recv_message_flags = op_payload->recv_message.flags;
1564  s->call_failed_before_recv_message =
1565  op_payload->recv_message.call_failed_before_recv_message;
1567  }
1568 
1569  if (op->recv_trailing_metadata) {
1571  GPR_ASSERT(s->collecting_stats == nullptr);
1572  s->collecting_stats = op_payload->recv_trailing_metadata.collect_stats;
1573  GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
1574  s->recv_trailing_metadata_finished =
1575  op_payload->recv_trailing_metadata.recv_trailing_metadata_ready;
1576  s->recv_trailing_metadata =
1577  op_payload->recv_trailing_metadata.recv_trailing_metadata;
1578  s->final_metadata_requested = true;
1580  }
1581 
1582  if (on_complete != nullptr) {
1584  "op->on_complete");
1585  }
1586 
1587  GRPC_CHTTP2_STREAM_UNREF(s, "perform_stream_op");
1588 }
1589 
1592  GPR_TIMER_SCOPE("perform_stream_op", 0);
1593  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
1594  grpc_chttp2_stream* s = reinterpret_cast<grpc_chttp2_stream*>(gs);
1595 
1596  if (!t->is_client) {
1597  if (op->send_initial_metadata) {
1598  GPR_ASSERT(!op->payload->send_initial_metadata.send_initial_metadata
1600  .has_value());
1601  }
1602  if (op->send_trailing_metadata) {
1603  GPR_ASSERT(!op->payload->send_trailing_metadata.send_trailing_metadata
1605  .has_value());
1606  }
1607  }
1608 
1610  gpr_log(GPR_INFO, "perform_stream_op[s=%p; op=%p]: %s", s, op,
1612  }
1613 
1614  GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op");
1615  op->handler_private.extra_arg = gs;
1616  t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
1617  perform_stream_op_locked, op, nullptr),
1618  GRPC_ERROR_NONE);
1619 }
1620 
1622  // callback remaining pings: they're not allowed to call into the transport,
1623  // and maybe they hold resources that need to be freed
1624  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1626  for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
1629  }
1631 }
1632 
1634  grpc_closure* on_initiate, grpc_closure* on_ack) {
1635  if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
1637  GRPC_ERROR_REF(t->closed_with_error));
1639  GRPC_ERROR_REF(t->closed_with_error));
1640  return;
1641  }
1642  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1644  GRPC_ERROR_NONE);
1646  GRPC_ERROR_NONE);
1647 }
1648 
1649 // Specialized form of send_ping_locked for keepalive ping. If there is already
1650 // a ping in progress, the keepalive ping would piggyback onto that ping,
1651 // instead of waiting for that ping to complete and then starting a new ping.
1653  if (!GRPC_ERROR_IS_NONE(t->closed_with_error)) {
1654  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
1655  start_keepalive_ping_locked, t, nullptr),
1656  GRPC_ERROR_REF(t->closed_with_error));
1657  t->combiner->Run(
1658  GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
1659  finish_keepalive_ping_locked, t, nullptr),
1660  GRPC_ERROR_REF(t->closed_with_error));
1661  return;
1662  }
1663  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1665  // There is a ping in flight. Add yourself to the inflight closure list.
1666  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
1667  start_keepalive_ping_locked, t, nullptr),
1668  GRPC_ERROR_REF(t->closed_with_error));
1671  GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
1672  finish_keepalive_ping, t, grpc_schedule_on_exec_ctx),
1673  GRPC_ERROR_NONE);
1674  return;
1675  }
1678  GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked, start_keepalive_ping,
1679  t, grpc_schedule_on_exec_ctx),
1680  GRPC_ERROR_NONE);
1683  GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked, finish_keepalive_ping,
1684  t, grpc_schedule_on_exec_ctx),
1685  GRPC_ERROR_NONE);
1686 }
1687 
1689  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
1690  t->combiner->Run(GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked,
1691  retry_initiate_ping_locked, t, nullptr),
1693 }
1694 
1696  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
1697  t->ping_state.is_delayed_ping_timer_set = false;
1698  if (GRPC_ERROR_IS_NONE(error)) {
1700  }
1701  GRPC_CHTTP2_UNREF_TRANSPORT(t, "retry_initiate_ping_locked");
1702 }
1703 
1705  grpc_chttp2_ping_queue* pq = &t->ping_queue;
1706  if (pq->inflight_id != id) {
1707  gpr_log(GPR_DEBUG, "Unknown ping response from %s: %" PRIx64,
1708  t->peer_string.c_str(), id);
1709  return;
1710  }
1715  }
1716 }
1717 
1718 namespace {
1719 
1720 // Fire and forget (deletes itself on completion). Does a graceful shutdown by
1721 // sending a GOAWAY frame with the last stream id set to 2^31-1, sending a ping
1722 // and waiting for an ack (effective waiting for an RTT) and then sending a
1723 // final GOAWAY freame with an updated last stream identifier. This helps ensure
1724 // that a connection can be cleanly shut down without losing requests.
1725 // In the event, that the client does not respond to the ping for some reason,
1726 // we add a 20 second deadline, after which we send the second goaway.
1727 class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
1728  public:
1729  static void Start(grpc_chttp2_transport* t) { new GracefulGoaway(t); }
1730 
1731  ~GracefulGoaway() override {
1732  GRPC_CHTTP2_UNREF_TRANSPORT(t_, "graceful goaway");
1733  }
1734 
1735  private:
1736  explicit GracefulGoaway(grpc_chttp2_transport* t) : t_(t) {
1737  t->sent_goaway_state = GRPC_CHTTP2_GRACEFUL_GOAWAY;
1738  GRPC_CHTTP2_REF_TRANSPORT(t_, "graceful goaway");
1739  grpc_chttp2_goaway_append((1u << 31) - 1, 0, grpc_empty_slice(), &t->qbuf);
1741  t, nullptr, GRPC_CLOSURE_INIT(&on_ping_ack_, OnPingAck, this, nullptr));
1743  Ref().release(); // Ref for the timer
1745  &timer_,
1747  GRPC_CLOSURE_INIT(&on_timer_, OnTimer, this, nullptr));
1748  }
1749 
1750  void MaybeSendFinalGoawayLocked() {
1751  if (t_->sent_goaway_state != GRPC_CHTTP2_GRACEFUL_GOAWAY) {
1752  // We already sent the final GOAWAY.
1753  return;
1754  }
1755  if (t_->destroying || !GRPC_ERROR_IS_NONE(t_->closed_with_error)) {
1757  GPR_INFO,
1758  "transport:%p %s peer:%s Transport already shutting down. "
1759  "Graceful GOAWAY abandoned.",
1760  t_, t_->is_client ? "CLIENT" : "SERVER", t_->peer_string.c_str()));
1761  return;
1762  }
1763  // Ping completed. Send final goaway.
1765  gpr_log(GPR_INFO,
1766  "transport:%p %s peer:%s Graceful shutdown: Ping received. "
1767  "Sending final GOAWAY with stream_id:%d",
1768  t_, t_->is_client ? "CLIENT" : "SERVER",
1769  t_->peer_string.c_str(), t_->last_new_stream_id));
1770  t_->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
1771  grpc_chttp2_goaway_append(t_->last_new_stream_id, 0, grpc_empty_slice(),
1772  &t_->qbuf);
1774  }
1775 
1776  static void OnPingAck(void* arg, grpc_error_handle /* error */) {
1777  auto* self = static_cast<GracefulGoaway*>(arg);
1778  self->t_->combiner->Run(
1779  GRPC_CLOSURE_INIT(&self->on_ping_ack_, OnPingAckLocked, self, nullptr),
1780  GRPC_ERROR_NONE);
1781  }
1782 
1783  static void OnPingAckLocked(void* arg, grpc_error_handle /* error */) {
1784  auto* self = static_cast<GracefulGoaway*>(arg);
1785  grpc_timer_cancel(&self->timer_);
1786  self->MaybeSendFinalGoawayLocked();
1787  self->Unref();
1788  }
1789 
1790  static void OnTimer(void* arg, grpc_error_handle error) {
1791  auto* self = static_cast<GracefulGoaway*>(arg);
1792  if (!GRPC_ERROR_IS_NONE(error)) {
1793  self->Unref();
1794  return;
1795  }
1796  self->t_->combiner->Run(
1797  GRPC_CLOSURE_INIT(&self->on_timer_, OnTimerLocked, self, nullptr),
1798  GRPC_ERROR_NONE);
1799  }
1800 
1801  static void OnTimerLocked(void* arg, grpc_error_handle /* error */) {
1802  auto* self = static_cast<GracefulGoaway*>(arg);
1803  self->MaybeSendFinalGoawayLocked();
1804  self->Unref();
1805  }
1806 
1808  grpc_closure on_ping_ack_;
1811 };
1812 
1813 } // namespace
1814 
1816  bool immediate_disconnect_hint) {
1817  grpc_http2_error_code http_error;
1820  &message, &http_error, nullptr);
1821  if (!t->is_client && http_error == GRPC_HTTP2_NO_ERROR &&
1822  !immediate_disconnect_hint) {
1823  // Do a graceful shutdown.
1824  if (t->sent_goaway_state == GRPC_CHTTP2_NO_GOAWAY_SEND) {
1825  GracefulGoaway::Start(t);
1826  } else {
1827  // Graceful GOAWAY is already in progress.
1828  }
1829  } else if (t->sent_goaway_state == GRPC_CHTTP2_NO_GOAWAY_SEND ||
1830  t->sent_goaway_state == GRPC_CHTTP2_GRACEFUL_GOAWAY) {
1831  // We want to log this irrespective of whether http tracing is enabled
1832  gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s", t->peer_string.c_str(),
1834  t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
1836  t->last_new_stream_id, static_cast<uint32_t>(http_error),
1838  } else {
1839  // Final GOAWAY has already been sent.
1840  }
1843 }
1844 
1846  if (++t->ping_recv_state.ping_strikes > t->ping_policy.max_ping_strikes &&
1847  t->ping_policy.max_ping_strikes != 0) {
1848  send_goaway(t,
1850  GRPC_ERROR_CREATE_FROM_STATIC_STRING("too_many_pings"),
1852  /*immediate_disconnect_hint=*/true);
1853  // The transport will be closed after the write is done
1855  t, grpc_error_set_int(
1856  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many pings"),
1858  }
1859 }
1860 
1862  if (!t->is_client) {
1863  t->ping_recv_state.last_ping_recv_time = grpc_core::Timestamp::InfPast();
1864  t->ping_recv_state.ping_strikes = 0;
1865  }
1866  t->ping_state.pings_before_data_required =
1867  t->ping_policy.max_pings_without_data;
1868 }
1869 
1870 static void perform_transport_op_locked(void* stream_op,
1871  grpc_error_handle /*error_ignored*/) {
1872  grpc_transport_op* op = static_cast<grpc_transport_op*>(stream_op);
1874  static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
1875 
1876  if (!GRPC_ERROR_IS_NONE(op->goaway_error)) {
1877  send_goaway(t, op->goaway_error, /*immediate_disconnect_hint=*/false);
1878  }
1879 
1880  if (op->set_accept_stream) {
1881  t->accept_stream_cb = op->set_accept_stream_fn;
1882  t->accept_stream_cb_user_data = op->set_accept_stream_user_data;
1883  }
1884 
1885  if (op->bind_pollset) {
1886  grpc_endpoint_add_to_pollset(t->ep, op->bind_pollset);
1887  }
1888 
1889  if (op->bind_pollset_set) {
1890  grpc_endpoint_add_to_pollset_set(t->ep, op->bind_pollset_set);
1891  }
1892 
1893  if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
1894  send_ping_locked(t, op->send_ping.on_initiate, op->send_ping.on_ack);
1896  }
1897 
1898  if (op->start_connectivity_watch != nullptr) {
1899  t->state_tracker.AddWatcher(op->start_connectivity_watch_state,
1900  std::move(op->start_connectivity_watch));
1901  }
1902  if (op->stop_connectivity_watch != nullptr) {
1903  t->state_tracker.RemoveWatcher(op->stop_connectivity_watch);
1904  }
1905 
1906  if (!GRPC_ERROR_IS_NONE(op->disconnect_with_error)) {
1907  send_goaway(t, GRPC_ERROR_REF(op->disconnect_with_error),
1908  /*immediate_disconnect_hint=*/true);
1909  close_transport_locked(t, op->disconnect_with_error);
1910  }
1911 
1913 
1914  GRPC_CHTTP2_UNREF_TRANSPORT(t, "transport_op");
1915 }
1916 
1918  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
1920  gpr_log(GPR_INFO, "perform_transport_op[t=%p]: %s", t,
1922  }
1923  op->handler_private.extra_arg = gt;
1924  GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
1925  t->combiner->Run(GRPC_CLOSURE_INIT(&op->handler_private.closure,
1926  perform_transport_op_locked, op, nullptr),
1927  GRPC_ERROR_NONE);
1928 }
1929 
1930 //
1931 // INPUT PROCESSING - GENERAL
1932 //
1933 
1935  grpc_chttp2_stream* s) {
1936  if (s->recv_initial_metadata_ready != nullptr &&
1937  s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
1938  if (s->seen_error) {
1939  grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
1940  }
1941  *s->recv_initial_metadata = std::move(s->initial_metadata_buffer);
1942  s->recv_initial_metadata->Set(grpc_core::PeerString(), t->peer_string);
1943  // If we didn't receive initial metadata from the wire and instead faked a
1944  // status (due to stream cancellations for example), let upper layers know
1945  // that trailing metadata is immediately available.
1946  if (s->trailing_metadata_available != nullptr &&
1947  s->published_metadata[0] != GRPC_METADATA_PUBLISHED_FROM_WIRE &&
1948  s->published_metadata[1] == GRPC_METADATA_SYNTHESIZED_FROM_FAKE) {
1949  *s->trailing_metadata_available = true;
1950  s->trailing_metadata_available = nullptr;
1951  }
1952  null_then_sched_closure(&s->recv_initial_metadata_ready);
1953  }
1954 }
1955 
1957  grpc_chttp2_stream* s) {
1958  if (s->recv_message_ready == nullptr) return;
1959 
1961  &s->flow_control);
1963 
1964  // Lambda is immediately invoked as a big scoped section that can be
1965  // exited out of at any point by returning.
1966  [&]() {
1967  if (s->final_metadata_requested && s->seen_error) {
1968  grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
1969  s->recv_message->reset();
1970  } else {
1971  if (s->frame_storage.length != 0) {
1972  while (true) {
1973  GPR_ASSERT(s->frame_storage.length > 0);
1974  uint32_t min_progress_size;
1976  s, &min_progress_size, &**s->recv_message, s->recv_message_flags);
1977  if (absl::holds_alternative<grpc_core::Pending>(r)) {
1978  if (s->read_closed) {
1979  grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
1980  s->recv_message->reset();
1981  break;
1982  } else {
1983  upd.SetMinProgressSize(min_progress_size);
1984  return; // Out of lambda to enclosing function
1985  }
1986  } else {
1987  error = absl::get<grpc_error_handle>(r);
1988  if (!GRPC_ERROR_IS_NONE(error)) {
1989  s->seen_error = true;
1990  grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
1991  break;
1992  } else {
1993  if (t->channelz_socket != nullptr) {
1994  t->channelz_socket->RecordMessageReceived();
1995  }
1996  break;
1997  }
1998  }
1999  }
2000  } else if (s->read_closed) {
2001  s->recv_message->reset();
2002  } else {
2004  return; // Out of lambda to enclosing function
2005  }
2006  }
2007  // save the length of the buffer before handing control back to application
2008  // threads. Needed to support correct flow control bookkeeping
2009  if (GRPC_ERROR_IS_NONE(error) && s->recv_message->has_value()) {
2010  null_then_sched_closure(&s->recv_message_ready);
2011  } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
2012  if (s->call_failed_before_recv_message != nullptr) {
2013  *s->call_failed_before_recv_message =
2014  (s->published_metadata[1] != GRPC_METADATA_PUBLISHED_AT_CLOSE);
2015  }
2016  null_then_sched_closure(&s->recv_message_ready);
2017  }
2019  }();
2020 
2021  upd.SetPendingSize(s->frame_storage.length);
2023 }
2024 
2026  grpc_chttp2_stream* s) {
2028  if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
2029  s->write_closed) {
2030  if (s->seen_error || !t->is_client) {
2031  grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
2032  }
2033  if (s->read_closed && s->frame_storage.length == 0 &&
2034  s->recv_trailing_metadata_finished != nullptr) {
2035  grpc_transport_move_stats(&s->stats, s->collecting_stats);
2036  s->collecting_stats = nullptr;
2037  *s->recv_trailing_metadata = std::move(s->trailing_metadata_buffer);
2038  s->recv_trailing_metadata->Set(grpc_core::PeerString(), t->peer_string);
2039  null_then_sched_closure(&s->recv_trailing_metadata_finished);
2040  }
2041  }
2042 }
2043 
2046  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
2047  grpc_chttp2_stream_map_delete(&t->stream_map, id));
2048  GPR_DEBUG_ASSERT(s);
2049  if (t->incoming_stream == s) {
2050  t->incoming_stream = nullptr;
2052  }
2053 
2054  if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
2056  if (t->sent_goaway_state == GRPC_CHTTP2_FINAL_GOAWAY_SENT) {
2059  "Last stream closed after sending GOAWAY", &error, 1));
2060  }
2061  }
2063  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream");
2064  }
2067 
2069 
2071 }
2072 
2074  grpc_error_handle due_to_error) {
2075  if (!t->is_client && !s->sent_trailing_metadata &&
2076  grpc_error_has_clear_grpc_status(due_to_error)) {
2077  close_from_api(t, s, due_to_error);
2078  return;
2079  }
2080 
2081  if (!s->read_closed || !s->write_closed) {
2082  if (s->id != 0) {
2083  grpc_http2_error_code http_error;
2084  grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
2085  &http_error, nullptr);
2087  t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
2089  }
2090  }
2091  if (!GRPC_ERROR_IS_NONE(due_to_error) && !s->seen_error) {
2092  s->seen_error = true;
2093  }
2094  grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
2095 }
2096 
2101  grpc_error_get_status(error, s->deadline, &status, &message, nullptr,
2102  nullptr);
2103  if (status != GRPC_STATUS_OK) {
2104  s->seen_error = true;
2105  }
2106  // stream_global->recv_trailing_metadata_finished gives us a
2107  // last chance replacement: we've received trailing metadata,
2108  // but something more important has become available to signal
2109  // to the upper layers - drop what we've got, and then publish
2110  // what we want - which is safe because we haven't told anyone
2111  // about the metadata yet
2112  if (s->published_metadata[1] == GRPC_METADATA_NOT_PUBLISHED ||
2113  s->recv_trailing_metadata_finished != nullptr) {
2114  s->trailing_metadata_buffer.Set(grpc_core::GrpcStatusMetadata(), status);
2115  if (!message.empty()) {
2116  s->trailing_metadata_buffer.Set(
2119  }
2120  s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
2122  }
2123 
2125 }
2126 
2128  size_t* nrefs) {
2129  if (GRPC_ERROR_IS_NONE(error)) return;
2130  for (size_t i = 0; i < *nrefs; i++) {
2131  if (error == refs[i]) {
2132  return;
2133  }
2134  }
2135  refs[*nrefs] = error;
2136  ++*nrefs;
2137 }
2138 
2140  grpc_chttp2_stream* s,
2141  const char* main_error_msg) {
2143  size_t nrefs = 0;
2144  add_error(s->read_closed_error, refs, &nrefs);
2145  add_error(s->write_closed_error, refs, &nrefs);
2146  add_error(extra_error, refs, &nrefs);
2148  if (nrefs > 0) {
2150  refs, nrefs);
2151  }
2152  GRPC_ERROR_UNREF(extra_error);
2153  return error;
2154 }
2155 
2157  grpc_chttp2_write_cb** list,
2159  while (*list) {
2160  grpc_chttp2_write_cb* cb = *list;
2161  *list = cb->next;
2163  "on_write_finished_cb");
2164  cb->next = t->write_cb_pool;
2165  t->write_cb_pool = cb;
2166  }
2168 }
2169 
2171  grpc_chttp2_stream* s,
2173  error =
2174  removal_error(error, s, "Pending writes failed due to stream closure");
2175  s->send_initial_metadata = nullptr;
2176  grpc_chttp2_complete_closure_step(t, s, &s->send_initial_metadata_finished,
2178  "send_initial_metadata_finished");
2179 
2180  s->send_trailing_metadata = nullptr;
2181  s->sent_trailing_metadata_op = nullptr;
2182  grpc_chttp2_complete_closure_step(t, s, &s->send_trailing_metadata_finished,
2184  "send_trailing_metadata_finished");
2185 
2186  grpc_chttp2_complete_closure_step(t, s, &s->send_message_finished,
2188  "fetching_send_message_finished");
2189  flush_write_list(t, s, &s->on_write_finished_cbs, GRPC_ERROR_REF(error));
2190  flush_write_list(t, s, &s->on_flow_controlled_cbs, error);
2191 }
2192 
2194  grpc_chttp2_stream* s, int close_reads,
2195  int close_writes, grpc_error_handle error) {
2196  if (s->read_closed && s->write_closed) {
2197  // already closed, but we should still fake the status if needed.
2198  grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
2199  if (!GRPC_ERROR_IS_NONE(overall_error)) {
2200  grpc_chttp2_fake_status(t, s, overall_error);
2201  }
2203  return;
2204  }
2205  bool closed_read = false;
2206  bool became_closed = false;
2207  if (close_reads && !s->read_closed) {
2208  s->read_closed_error = GRPC_ERROR_REF(error);
2209  s->read_closed = true;
2210  closed_read = true;
2211  }
2212  if (close_writes && !s->write_closed) {
2213  s->write_closed_error = GRPC_ERROR_REF(error);
2214  s->write_closed = true;
2216  }
2217  if (s->read_closed && s->write_closed) {
2218  became_closed = true;
2219  grpc_error_handle overall_error =
2220  removal_error(GRPC_ERROR_REF(error), s, "Stream removed");
2221  if (s->id != 0) {
2222  remove_stream(t, s->id, GRPC_ERROR_REF(overall_error));
2223  } else {
2224  // Purge streams waiting on concurrency still waiting for id assignment
2226  }
2227  if (!GRPC_ERROR_IS_NONE(overall_error)) {
2228  grpc_chttp2_fake_status(t, s, overall_error);
2229  }
2230  }
2231  if (closed_read) {
2232  for (int i = 0; i < 2; i++) {
2233  if (s->published_metadata[i] == GRPC_METADATA_NOT_PUBLISHED) {
2234  s->published_metadata[i] = GRPC_METADATA_PUBLISHED_AT_CLOSE;
2235  }
2236  }
2239  }
2240  if (became_closed) {
2242  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2");
2243  }
2245 }
2246 
2249  grpc_slice hdr;
2250  grpc_slice status_hdr;
2251  grpc_slice http_status_hdr;
2252  grpc_slice content_type_hdr;
2253  grpc_slice message_pfx;
2254  uint8_t* p;
2255  uint32_t len = 0;
2258  grpc_error_get_status(error, s->deadline, &grpc_status, &message, nullptr,
2259  nullptr);
2260 
2261  GPR_ASSERT(grpc_status >= 0 && (int)grpc_status < 100);
2262 
2263  // Hand roll a header block.
2264  // This is unnecessarily ugly - at some point we should find a more
2265  // elegant solution.
2266  // It's complicated by the fact that our send machinery would be dead by
2267  // the time we got around to sending this, so instead we ignore HPACK
2268  // compression and just write the uncompressed bytes onto the wire.
2269  if (!s->sent_initial_metadata) {
2270  http_status_hdr = GRPC_SLICE_MALLOC(13);
2271  p = GRPC_SLICE_START_PTR(http_status_hdr);
2272  *p++ = 0x00;
2273  *p++ = 7;
2274  *p++ = ':';
2275  *p++ = 's';
2276  *p++ = 't';
2277  *p++ = 'a';
2278  *p++ = 't';
2279  *p++ = 'u';
2280  *p++ = 's';
2281  *p++ = 3;
2282  *p++ = '2';
2283  *p++ = '0';
2284  *p++ = '0';
2285  GPR_ASSERT(p == GRPC_SLICE_END_PTR(http_status_hdr));
2286  len += static_cast<uint32_t> GRPC_SLICE_LENGTH(http_status_hdr);
2287 
2288  content_type_hdr = GRPC_SLICE_MALLOC(31);
2289  p = GRPC_SLICE_START_PTR(content_type_hdr);
2290  *p++ = 0x00;
2291  *p++ = 12;
2292  *p++ = 'c';
2293  *p++ = 'o';
2294  *p++ = 'n';
2295  *p++ = 't';
2296  *p++ = 'e';
2297  *p++ = 'n';
2298  *p++ = 't';
2299  *p++ = '-';
2300  *p++ = 't';
2301  *p++ = 'y';
2302  *p++ = 'p';
2303  *p++ = 'e';
2304  *p++ = 16;
2305  *p++ = 'a';
2306  *p++ = 'p';
2307  *p++ = 'p';
2308  *p++ = 'l';
2309  *p++ = 'i';
2310  *p++ = 'c';
2311  *p++ = 'a';
2312  *p++ = 't';
2313  *p++ = 'i';
2314  *p++ = 'o';
2315  *p++ = 'n';
2316  *p++ = '/';
2317  *p++ = 'g';
2318  *p++ = 'r';
2319  *p++ = 'p';
2320  *p++ = 'c';
2321  GPR_ASSERT(p == GRPC_SLICE_END_PTR(content_type_hdr));
2322  len += static_cast<uint32_t> GRPC_SLICE_LENGTH(content_type_hdr);
2323  }
2324 
2325  status_hdr = GRPC_SLICE_MALLOC(15 + (grpc_status >= 10));
2326  p = GRPC_SLICE_START_PTR(status_hdr);
2327  *p++ = 0x00; /* literal header, not indexed */
2328  *p++ = 11; /* len(grpc-status) */
2329  *p++ = 'g';
2330  *p++ = 'r';
2331  *p++ = 'p';
2332  *p++ = 'c';
2333  *p++ = '-';
2334  *p++ = 's';
2335  *p++ = 't';
2336  *p++ = 'a';
2337  *p++ = 't';
2338  *p++ = 'u';
2339  *p++ = 's';
2340  if (grpc_status < 10) {
2341  *p++ = 1;
2342  *p++ = static_cast<uint8_t>('0' + grpc_status);
2343  } else {
2344  *p++ = 2;
2345  *p++ = static_cast<uint8_t>('0' + (grpc_status / 10));
2346  *p++ = static_cast<uint8_t>('0' + (grpc_status % 10));
2347  }
2348  GPR_ASSERT(p == GRPC_SLICE_END_PTR(status_hdr));
2349  len += static_cast<uint32_t> GRPC_SLICE_LENGTH(status_hdr);
2350 
2351  size_t msg_len = message.length();
2352  GPR_ASSERT(msg_len <= UINT32_MAX);
2353  grpc_core::VarintWriter<1> msg_len_writer(msg_len);
2354  message_pfx = GRPC_SLICE_MALLOC(14 + msg_len_writer.length());
2355  p = GRPC_SLICE_START_PTR(message_pfx);
2356  *p++ = 0x00; /* literal header, not indexed */
2357  *p++ = 12; /* len(grpc-message) */
2358  *p++ = 'g';
2359  *p++ = 'r';
2360  *p++ = 'p';
2361  *p++ = 'c';
2362  *p++ = '-';
2363  *p++ = 'm';
2364  *p++ = 'e';
2365  *p++ = 's';
2366  *p++ = 's';
2367  *p++ = 'a';
2368  *p++ = 'g';
2369  *p++ = 'e';
2370  msg_len_writer.Write(0, p);
2371  p += msg_len_writer.length();
2372  GPR_ASSERT(p == GRPC_SLICE_END_PTR(message_pfx));
2373  len += static_cast<uint32_t> GRPC_SLICE_LENGTH(message_pfx);
2374  len += static_cast<uint32_t>(msg_len);
2375 
2376  hdr = GRPC_SLICE_MALLOC(9);
2377  p = GRPC_SLICE_START_PTR(hdr);
2378  *p++ = static_cast<uint8_t>(len >> 16);
2379  *p++ = static_cast<uint8_t>(len >> 8);
2380  *p++ = static_cast<uint8_t>(len);
2383  *p++ = static_cast<uint8_t>(s->id >> 24);
2384  *p++ = static_cast<uint8_t>(s->id >> 16);
2385  *p++ = static_cast<uint8_t>(s->id >> 8);
2386  *p++ = static_cast<uint8_t>(s->id);
2387  GPR_ASSERT(p == GRPC_SLICE_END_PTR(hdr));
2388 
2389  grpc_slice_buffer_add(&t->qbuf, hdr);
2390  if (!s->sent_initial_metadata) {
2391  grpc_slice_buffer_add(&t->qbuf, http_status_hdr);
2392  grpc_slice_buffer_add(&t->qbuf, content_type_hdr);
2393  }
2394  grpc_slice_buffer_add(&t->qbuf, status_hdr);
2395  grpc_slice_buffer_add(&t->qbuf, message_pfx);
2396  grpc_slice_buffer_add(&t->qbuf,
2400  &s->stats.outgoing);
2401 
2404 }
2405 
2409 };
2410 
2411 static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) {
2412  cancel_stream_cb_args* args = static_cast<cancel_stream_cb_args*>(user_data);
2413  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(stream);
2415 }
2416 
2419  intptr_t http2_error;
2420  // If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
2421  if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
2425  }
2430 }
2431 
2432 //
2433 // INPUT PROCESSING - PARSING
2434 //
2435 
2436 template <class F>
2440  switch (urgency) {
2442  break;
2444  grpc_chttp2_initiate_write(t, reason);
2447  action();
2448  break;
2449  }
2450 }
2451 
2455  WithUrgency(t, action.send_stream_update(),
2457  if (s->id != 0) {
2458  grpc_chttp2_mark_stream_writable(t, s);
2459  }
2460  });
2461  WithUrgency(t, action.send_transport_update(),
2463  WithUrgency(t, action.send_initial_window_update(),
2465  queue_setting_update(t,
2466  GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
2467  action.initial_window_size());
2468  });
2469  WithUrgency(t, action.send_max_frame_size_update(),
2471  queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
2472  action.max_frame_size());
2473  });
2474 }
2475 
2478  size_t i = 0;
2481 
2483 
2485  for (; i < t->read_buffer.count && GRPC_ERROR_IS_NONE(parse_error); i++) {
2486  parse_error =
2487  grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
2488  }
2493  "Trying to connect an http1.x server"),
2497  }
2499 
2502  return error;
2503 }
2504 
2505 static void read_action(void* tp, grpc_error_handle error) {
2506  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2507  t->combiner->Run(
2508  GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
2510 }
2511 
2513  GPR_TIMER_SCOPE("reading_action_locked", 0);
2514 
2515  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2516 
2517  (void)GRPC_ERROR_REF(error);
2518 
2520  if (!GRPC_ERROR_IS_NONE(err)) {
2522  "Endpoint read failed", &err, 1),
2524  t->write_state);
2525  }
2526  std::swap(err, error);
2528  if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2529  GPR_TIMER_SCOPE("reading_action.parse", 0);
2530  size_t i = 0;
2532  GRPC_ERROR_NONE};
2533  for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
2534  errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
2535  }
2536  if (errors[1] != GRPC_ERROR_NONE) {
2537  errors[2] = try_http_parsing(t);
2540  "Failed parsing HTTP/2", errors, GPR_ARRAY_SIZE(errors));
2541  }
2542  for (i = 0; i < GPR_ARRAY_SIZE(errors); i++) {
2544  }
2545 
2546  GPR_TIMER_SCOPE("post_parse_locked", 0);
2547  if (t->initial_window_update != 0) {
2548  if (t->initial_window_update > 0) {
2549  grpc_chttp2_stream* s;
2554  }
2555  }
2556  t->initial_window_update = 0;
2557  }
2558  }
2559 
2560  GPR_TIMER_SCOPE("post_reading_action_locked", 0);
2561  bool keep_reading = false;
2562  if (GRPC_ERROR_IS_NONE(error) && !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2564  "Transport closed", &t->closed_with_error, 1);
2565  }
2566  if (!GRPC_ERROR_IS_NONE(error)) {
2567  // If a goaway frame was received, this might be the reason why the read
2568  // failed. Add this info to the error
2569  if (!GRPC_ERROR_IS_NONE(t->goaway_error)) {
2570  error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
2571  }
2572 
2574  t->endpoint_reading = 0;
2575  } else if (GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2576  keep_reading = true;
2577  // Since we have read a byte, reset the keepalive timer
2578  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
2579  grpc_timer_cancel(&t->keepalive_ping_timer);
2580  }
2581  }
2583 
2584  if (keep_reading) {
2585  if (t->num_pending_induced_frames >= DEFAULT_MAX_PENDING_INDUCED_FRAMES) {
2586  t->reading_paused_on_pending_induced_frames = true;
2588  gpr_log(GPR_INFO,
2589  "transport %p : Pausing reading due to too "
2590  "many unwritten SETTINGS ACK and RST_STREAM frames",
2591  t));
2592  } else {
2594  }
2595  } else {
2596  GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
2597  }
2598 
2600 }
2601 
2603  const bool urgent = !GRPC_ERROR_IS_NONE(t->goaway_error);
2604  GRPC_CLOSURE_INIT(&t->read_action_locked, read_action, t,
2605  grpc_schedule_on_exec_ctx);
2606  grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent,
2607  /*min_progress_size=*/1);
2608 }
2609 
2610 // t is reffed prior to calling the first time, and once the callback chain
2611 // that kicks off finishes, it's unreffed
2613  t->flow_control.bdp_estimator()->SchedulePing();
2615  t,
2616  GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked, start_bdp_ping, t,
2617  grpc_schedule_on_exec_ctx),
2618  GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked, finish_bdp_ping, t,
2619  grpc_schedule_on_exec_ctx));
2621 }
2622 
2623 static void start_bdp_ping(void* tp, grpc_error_handle error) {
2624  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2625  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked,
2626  start_bdp_ping_locked, t, nullptr),
2628 }
2629 
2631  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2633  gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
2635  }
2636  if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2637  return;
2638  }
2639  // Reset the keepalive ping timer
2640  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
2641  grpc_timer_cancel(&t->keepalive_ping_timer);
2642  }
2643  t->flow_control.bdp_estimator()->StartPing();
2644  t->bdp_ping_started = true;
2645 }
2646 
2647 static void finish_bdp_ping(void* tp, grpc_error_handle error) {
2648  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2649  t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
2650  finish_bdp_ping_locked, t, nullptr),
2652 }
2653 
2655  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2657  gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
2659  }
2660  if (!GRPC_ERROR_IS_NONE(error) || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2661  GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
2662  return;
2663  }
2664  if (!t->bdp_ping_started) {
2665  // start_bdp_ping_locked has not been run yet. Schedule
2666  // finish_bdp_ping_locked to be run later.
2667  t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
2668  finish_bdp_ping_locked, t, nullptr),
2670  return;
2671  }
2672  t->bdp_ping_started = false;
2673  grpc_core::Timestamp next_ping =
2674  t->flow_control.bdp_estimator()->CompletePing();
2675  grpc_chttp2_act_on_flowctl_action(t->flow_control.PeriodicUpdate(), t,
2676  nullptr);
2677  GPR_ASSERT(!t->have_next_bdp_ping_timer);
2678  t->have_next_bdp_ping_timer = true;
2679  GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
2680  next_bdp_ping_timer_expired, t, grpc_schedule_on_exec_ctx);
2681  grpc_timer_init(&t->next_bdp_ping_timer, next_ping,
2682  &t->next_bdp_ping_timer_expired_locked);
2683 }
2684 
2686  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2687  t->combiner->Run(
2688  GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
2691 }
2692 
2695  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
2696  GPR_ASSERT(t->have_next_bdp_ping_timer);
2697  t->have_next_bdp_ping_timer = false;
2698  if (!GRPC_ERROR_IS_NONE(error)) {
2699  GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
2700  return;
2701  }
2702  if (t->flow_control.bdp_estimator()->accumulator() == 0) {
2703  // Block the bdp ping till we receive more data.
2704  t->bdp_ping_blocked = true;
2705  GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
2706  } else {
2708  }
2709 }
2710 
2712  bool is_client) {
2713  size_t i;
2714  if (args) {
2715  for (i = 0; i < args->num_args; i++) {
2716  if (0 == strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) {
2717  const int value = grpc_channel_arg_get_integer(
2718  &args->args[i], {is_client ? g_default_client_keepalive_time_ms
2719  : g_default_server_keepalive_time_ms,
2720  1, INT_MAX});
2721  if (is_client) {
2723  } else {
2725  }
2726  } else if (0 ==
2727  strcmp(args->args[i].key, GRPC_ARG_KEEPALIVE_TIMEOUT_MS)) {
2728  const int value = grpc_channel_arg_get_integer(
2729  &args->args[i], {is_client ? g_default_client_keepalive_timeout_ms
2730  : g_default_server_keepalive_timeout_ms,
2731  0, INT_MAX});
2732  if (is_client) {
2734  } else {
2736  }
2737  } else if (0 == strcmp(args->args[i].key,
2739  const bool value = static_cast<uint32_t>(grpc_channel_arg_get_integer(
2740  &args->args[i],
2741  {is_client ? g_default_client_keepalive_permit_without_calls
2742  : g_default_server_keepalive_timeout_ms,
2743  0, 1}));
2744  if (is_client) {
2746  } else {
2748  }
2749  } else if (0 ==
2750  strcmp(args->args[i].key, GRPC_ARG_HTTP2_MAX_PING_STRIKES)) {
2752  &args->args[i], {g_default_max_ping_strikes, 0, INT_MAX});
2753  } else if (0 == strcmp(args->args[i].key,
2756  &args->args[i], {g_default_max_pings_without_data, 0, INT_MAX});
2757  } else if (0 ==
2758  strcmp(
2759  args->args[i].key,
2763  &args->args[i],
2764  {g_default_min_recv_ping_interval_without_data_ms, 0, INT_MAX});
2765  }
2766  }
2767  }
2768 }
2769 
2771  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2772  t->combiner->Run(GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked,
2773  init_keepalive_ping_locked, t, nullptr),
2775 }
2776 
2778  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2779  GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
2780  if (t->destroying || !GRPC_ERROR_IS_NONE(t->closed_with_error)) {
2781  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
2782  } else if (GRPC_ERROR_IS_NONE(error)) {
2783  if (t->keepalive_permit_without_calls ||
2784  grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
2785  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
2786  GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive ping end");
2787  grpc_timer_init_unset(&t->keepalive_watchdog_timer);
2790  } else {
2791  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2792  GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2793  grpc_schedule_on_exec_ctx);
2794  grpc_timer_init(&t->keepalive_ping_timer,
2795  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2796  &t->init_keepalive_ping_locked);
2797  }
2798  } else if (error == GRPC_ERROR_CANCELLED) {
2799  // The keepalive ping timer may be cancelled by bdp
2800  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2801  GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2802  grpc_schedule_on_exec_ctx);
2803  grpc_timer_init(&t->keepalive_ping_timer,
2804  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2805  &t->init_keepalive_ping_locked);
2806  }
2807  GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
2808 }
2809 
2811  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2812  t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
2813  start_keepalive_ping_locked, t, nullptr),
2815 }
2816 
2818  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2819  if (!GRPC_ERROR_IS_NONE(error)) {
2820  return;
2821  }
2822  if (t->channelz_socket != nullptr) {
2823  t->channelz_socket->RecordKeepaliveSent();
2824  }
2827  gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string.c_str());
2828  }
2829  GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
2830  GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
2831  keepalive_watchdog_fired, t, grpc_schedule_on_exec_ctx);
2832  grpc_timer_init(&t->keepalive_watchdog_timer,
2833  grpc_core::ExecCtx::Get()->Now() + t->keepalive_timeout,
2834  &t->keepalive_watchdog_fired_locked);
2835  t->keepalive_ping_started = true;
2836 }
2837 
2839  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2840  t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
2841  finish_keepalive_ping_locked, t, nullptr),
2843 }
2844 
2846  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2847  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
2848  if (GRPC_ERROR_IS_NONE(error)) {
2851  gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
2852  }
2853  if (!t->keepalive_ping_started) {
2854  // start_keepalive_ping_locked has not run yet. Reschedule
2855  // finish_keepalive_ping_locked for it to be run later.
2856  t->combiner->Run(
2857  GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
2858  finish_keepalive_ping_locked, t, nullptr),
2860  return;
2861  }
2862  t->keepalive_ping_started = false;
2863  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
2864  grpc_timer_cancel(&t->keepalive_watchdog_timer);
2865  GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
2866  GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked, init_keepalive_ping, t,
2867  grpc_schedule_on_exec_ctx);
2868  grpc_timer_init(&t->keepalive_ping_timer,
2869  grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
2870  &t->init_keepalive_ping_locked);
2871  }
2872  }
2873  GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive ping end");
2874 }
2875 
2877  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2878  t->combiner->Run(
2879  GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
2880  keepalive_watchdog_fired_locked, t, nullptr),
2882 }
2883 
2886  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2887  if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
2888  if (GRPC_ERROR_IS_NONE(error)) {
2889  gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
2890  t->peer_string.c_str());
2891  t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
2894  "keepalive watchdog timeout"),
2897  }
2898  } else {
2899  // The watchdog timer should have been cancelled by
2900  // finish_keepalive_ping_locked.
2902  gpr_log(GPR_ERROR, "keepalive_ping_end state error: %d (expect: %d)",
2903  t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
2904  }
2905  }
2906  GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive watchdog");
2907 }
2908 
2909 //
2910 // CALLBACK LOOP
2911 //
2912 
2915  const absl::Status& status,
2916  const char* reason) {
2918  gpr_log(GPR_INFO, "transport %p set connectivity_state=%d", t, state));
2919  t->state_tracker.SetState(state, status, reason);
2920 }
2921 
2922 //
2923 // POLLSET STUFF
2924 //
2925 
2926 static void set_pollset(grpc_transport* gt, grpc_stream* /*gs*/,
2927  grpc_pollset* pollset) {
2928  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
2929  grpc_endpoint_add_to_pollset(t->ep, pollset);
2930 }
2931 
2932 static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
2933  grpc_pollset_set* pollset_set) {
2934  grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(gt);
2935  grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
2936 }
2937 
2938 //
2939 // RESOURCE QUOTAS
2940 //
2941 
2943  if (!t->benign_reclaimer_registered) {
2944  t->benign_reclaimer_registered = true;
2945  GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer");
2946  t->memory_owner.PostReclaimer(
2949  if (sweep.has_value()) {
2950  GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked,
2951  benign_reclaimer_locked, t,
2952  grpc_schedule_on_exec_ctx);
2953  t->active_reclamation = std::move(*sweep);
2954  t->combiner->Run(&t->benign_reclaimer_locked, GRPC_ERROR_NONE);
2955  } else {
2956  GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
2957  }
2958  });
2959  }
2960 }
2961 
2963  if (!t->destructive_reclaimer_registered) {
2964  t->destructive_reclaimer_registered = true;
2965  GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer");
2966  t->memory_owner.PostReclaimer(
2969  if (sweep.has_value()) {
2970  GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked,
2971  destructive_reclaimer_locked, t,
2972  grpc_schedule_on_exec_ctx);
2973  t->active_reclamation = std::move(*sweep);
2974  t->combiner->Run(&t->destructive_reclaimer_locked, GRPC_ERROR_NONE);
2975  } else {
2976  GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
2977  }
2978  });
2979  }
2980 }
2981 
2983  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
2984  if (GRPC_ERROR_IS_NONE(error) &&
2985  grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
2986  // Channel with no active streams: send a goaway to try and make it
2987  // disconnect cleanly
2989  gpr_log(GPR_INFO, "HTTP2: %s - send goaway to free memory",
2990  t->peer_string.c_str());
2991  }
2992  send_goaway(t,
2994  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
2996  /*immediate_disconnect_hint=*/true);
2997  } else if (GRPC_ERROR_IS_NONE(error) &&
2999  gpr_log(GPR_INFO,
3000  "HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
3001  " streams",
3002  t->peer_string.c_str(),
3003  grpc_chttp2_stream_map_size(&t->stream_map));
3004  }
3005  t->benign_reclaimer_registered = false;
3006  if (error != GRPC_ERROR_CANCELLED) {
3007  t->active_reclamation.Finish();
3008  }
3009  GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
3010 }
3011 
3013  grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
3014  size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
3015  t->destructive_reclaimer_registered = false;
3016  if (GRPC_ERROR_IS_NONE(error) && n > 0) {
3017  grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
3018  grpc_chttp2_stream_map_rand(&t->stream_map));
3020  gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d",
3021  t->peer_string.c_str(), s->id);
3022  }
3024  t, s,
3028  if (n > 1) {
3029  // Since we cancel one stream per destructive reclamation, if
3030  // there are more streams left, we can immediately post a new
3031  // reclaimer in case the resource quota needs to free more
3032  // memory
3034  }
3035  }
3036  if (error != GRPC_ERROR_CANCELLED) {
3037  t->active_reclamation.Finish();
3038  }
3039  GRPC_CHTTP2_UNREF_TRANSPORT(t, "destructive_reclaimer");
3040 }
3041 
3042 //
3043 // MONITORING
3044 //
3045 
3048  switch (reason) {
3050  return "INITIAL_WRITE";
3052  return "START_NEW_STREAM";
3054  return "SEND_MESSAGE";
3056  return "SEND_INITIAL_METADATA";
3058  return "SEND_TRAILING_METADATA";
3060  return "RETRY_SEND_PING";
3062  return "CONTINUE_PINGS";
3064  return "GOAWAY_SENT";
3066  return "RST_STREAM";
3068  return "CLOSE_FROM_API";
3070  return "STREAM_FLOW_CONTROL";
3072  return "TRANSPORT_FLOW_CONTROL";
3074  return "SEND_SETTINGS";
3076  return "SETTINGS_ACK";
3078  return "FLOW_CONTROL_UNSTALLED_BY_SETTING";
3080  return "FLOW_CONTROL_UNSTALLED_BY_UPDATE";
3082  return "APPLICATION_PING";
3084  return "BDP_PING";
3086  return "KEEPALIVE_PING";
3088  return "TRANSPORT_FLOW_CONTROL_UNSTALLED";
3090  return "PING_RESPONSE";
3092  return "FORCE_RST_STREAM";
3093  }
3094  GPR_UNREACHABLE_CODE(return "unknown");
3095 }
3096 
3098  return (reinterpret_cast<grpc_chttp2_transport*>(t))->ep;
3099 }
3100 
3102  "chttp2",
3103  init_stream,
3104  nullptr,
3105  set_pollset,
3112 
3113 static const grpc_transport_vtable* get_vtable(void) { return &vtable; }
3114 
3118  reinterpret_cast<grpc_chttp2_transport*>(transport);
3119  return t->channelz_socket;
3120 }
3121 
3123  const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client) {
3124  auto t = new grpc_chttp2_transport(channel_args, ep, is_client);
3125  return &t->base;
3126 }
3127 
3130  grpc_closure* notify_on_receive_settings, grpc_closure* notify_on_close) {
3132  reinterpret_cast<grpc_chttp2_transport*>(transport);
3134  t, "reading_action"); /* matches unref inside reading_action */
3135  if (read_buffer != nullptr) {
3136  grpc_slice_buffer_move_into(read_buffer, &t->read_buffer);
3137  gpr_free(read_buffer);
3138  }
3139  t->notify_on_receive_settings = notify_on_receive_settings;
3140  t->notify_on_close = notify_on_close;
3141  t->combiner->Run(
3142  GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
3143  GRPC_ERROR_NONE);
3144 }
grpc_chttp2_fake_status
void grpc_chttp2_fake_status(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error_handle error)
Definition: chttp2_transport.cc:2097
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
grpc_keepalive_trace
grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive")
g_default_client_keepalive_time_ms
static int g_default_client_keepalive_time_ms
Definition: chttp2_transport.cc:120
GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER
Definition: grpc_types.h:194
grpc_chttp2_maybe_complete_recv_trailing_metadata
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:2025
slice.h
global_config_env.h
grpc_chttp2_complete_closure_step
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport *t, grpc_chttp2_stream *, grpc_closure **pclosure, grpc_error_handle error, const char *desc)
Definition: chttp2_transport.cc:1247
next_bdp_ping_timer_expired
static void next_bdp_ping_timer_expired(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2685
absl::Cord
Definition: abseil-cpp/absl/strings/cord.h:150
grpc_chttp2_transport::bdp_ping_blocked
bool bdp_ping_blocked
Definition: src/core/ext/transport/chttp2/transport/internal.h:385
grpc_core::MetadataMap::Log
void Log(metadata_detail::LogFn log_fn) const
Definition: metadata_batch.h:1020
grpc_core::chttp2::FlowControlAction::Urgency::UPDATE_IMMEDIATELY
@ UPDATE_IMMEDIATELY
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
grpc_op::flags
uint32_t flags
Definition: grpc_types.h:644
grpc_transport_move_stats
void grpc_transport_move_stats(grpc_transport_stream_stats *from, grpc_transport_stream_stats *to)
Definition: transport.cc:86
destroy_transport
static void destroy_transport(grpc_transport *gt)
Definition: chttp2_transport.cc:585
grpc_slice_buffer_move_into
GPRAPI void grpc_slice_buffer_move_into(grpc_slice_buffer *src, grpc_slice_buffer *dst)
Definition: slice/slice_buffer.cc:291
init_keepalive_pings_if_enabled
static void init_keepalive_pings_if_enabled(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:467
grpc_core::GrpcTimeoutMetadata
Definition: metadata_batch.h:59
GRPC_CHANNEL_READY
@ GRPC_CHANNEL_READY
Definition: include/grpc/impl/codegen/connectivity_state.h:36
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL
@ GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL
Definition: src/core/ext/transport/chttp2/transport/internal.h:119
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SETTINGS_ACK
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SETTINGS_ACK()
Definition: stats_data.h:281
timer_
grpc_timer timer_
Definition: channel_connectivity.cc:218
GPR_GLOBAL_CONFIG_DEFINE_BOOL
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_experimental_enable_peer_state_based_framing, false, "If set, the max sizes of frames sent to lower layers is controlled based " "on the peer's memory pressure which is reflected in its max http2 frame " "size.")
g_default_server_keepalive_time_ms
static int g_default_server_keepalive_time_ms
Definition: chttp2_transport.cc:124
pollset.h
destructive_reclaimer_locked
static void destructive_reclaimer_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:3012
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
grpc_chttp2_goaway_parser_destroy
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser *p)
Definition: frame_goaway.cc:39
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE()
Definition: stats_data.h:290
metadata_batch.h
GRPC_STATUS_UNAVAILABLE
@ GRPC_STATUS_UNAVAILABLE
Definition: include/grpc/impl/codegen/status.h:143
GRPC_CHTTP2_KEEPALIVE_STATE_WAITING
@ GRPC_CHTTP2_KEEPALIVE_STATE_WAITING
Definition: src/core/ext/transport/chttp2/transport/internal.h:232
grpc_slice_ref_internal
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:32
init_transport_keepalive_settings
static void init_transport_keepalive_settings(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:433
start_bdp_ping
static void start_bdp_ping(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2623
absl::StrCat
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: abseil-cpp/absl/strings/str_cat.cc:98
grpc_chttp2_repeated_ping_state::pings_before_data_required
int pings_before_data_required
Definition: src/core/ext/transport/chttp2/transport/internal.h:146
grpc_chttp2_list_remove_writable_stream
bool grpc_chttp2_list_remove_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:154
GRPC_ARG_HTTP2_MAX_PING_STRIKES
#define GRPC_ARG_HTTP2_MAX_PING_STRIKES
Definition: grpc_types.h:231
grpc_chttp2_list_pop_writable_stream
bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:149
connectivity_state.h
grpc_core::ExecCtx::RunList
static void RunList(const DebugLocation &location, grpc_closure_list *list)
Definition: exec_ctx.cc:129
absl::StrFormat
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
Definition: abseil-cpp/absl/strings/str_format.h:338
grpc_core::TestOnlyGlobalHttp2TransportDestructCallback
void(* TestOnlyGlobalHttp2TransportDestructCallback)()
Definition: chttp2_transport.h:59
GPR_DEBUG_ASSERT
#define GPR_DEBUG_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:103
grpc_transport_vtable
Definition: transport_impl.h:37
send_goaway
static void send_goaway(grpc_chttp2_transport *t, grpc_error_handle error, bool immediate_disconnect_hint)
Definition: chttp2_transport.cc:1815
timers.h
GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING
@ GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING
Definition: src/core/ext/transport/chttp2/transport/internal.h:124
grpc_core::chttp2::FlowControlAction::Urgency::QUEUE_UPDATE
@ QUEUE_UPDATE
grpc_chttp2_parsing_accept_stream
grpc_chttp2_stream * grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport *t, uint32_t id)
Definition: chttp2_transport.cc:766
grpc_chttp2_transport::lists
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT]
Definition: src/core/ext/transport/chttp2/transport/internal.h:269
GRPC_HTTP2_ENHANCE_YOUR_CALM
@ GRPC_HTTP2_ENHANCE_YOUR_CALM
Definition: http2_errors.h:35
start_keepalive_ping
static void start_keepalive_ping(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2810
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext::SetPendingSize
void SetPendingSize(int64_t pending_size)
Definition: flow_control.cc:307
grpc_channel_arg_get_integer
int grpc_channel_arg_get_integer(const grpc_arg *arg, const grpc_integer_options options)
Definition: channel_args.cc:405
grpc_http_parser_eof
grpc_error_handle grpc_http_parser_eof(grpc_http_parser *parser)
Definition: src/core/lib/http/parser.cc:457
grpc_slice_from_copied_string
GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source)
Definition: slice/slice.cc:177
GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE
@ GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE
Definition: src/core/ext/transport/chttp2/transport/internal.h:108
cancel_stream_cb_args::error
grpc_error_handle error
Definition: chttp2_transport.cc:2407
internal.h
grpc_create_chttp2_transport
grpc_transport * grpc_create_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client)
Definition: chttp2_transport.cc:3122
grpc_chttp2_begin_write
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(grpc_chttp2_transport *t)
Definition: writing.cc:627
GPR_GLOBAL_CONFIG_GET
#define GPR_GLOBAL_CONFIG_GET(name)
Definition: global_config_generic.h:24
varint.h
grpc_chttp2_setting_parameters
Definition: http2_settings.h:49
grpc_core::TestOnlySetGlobalHttp2TransportDestructCallback
void TestOnlySetGlobalHttp2TransportDestructCallback(TestOnlyGlobalHttp2TransportDestructCallback callback)
Definition: chttp2_transport.cc:217
grpc_chttp2_ping_queue::lists
grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT]
Definition: src/core/ext/transport/chttp2/transport/internal.h:136
GPR_TIMER_SCOPE
#define GPR_TIMER_SCOPE(tag, important)
Definition: src/core/lib/profiling/timers.h:43
GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
Definition: grpc_types.h:186
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::kKeepaliveThrottlingKey
constexpr const char * kKeepaliveThrottlingKey
Definition: transport.h:598
GRPC_ERROR_INT_HTTP2_ERROR
@ GRPC_ERROR_INT_HTTP2_ERROR
http2 error code associated with the error (see the HTTP2 RFC)
Definition: error.h:77
perform_transport_op_locked
static void perform_transport_op_locked(void *stream_op, grpc_error_handle)
Definition: chttp2_transport.cc:1870
grpc_chttp2_maybe_complete_recv_message
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:1956
grpc_chttp2_stream::t
grpc_chttp2_transport * t
Definition: src/core/ext/transport/chttp2/transport/internal.h:462
GRPC_ARG_OPTIMIZATION_TARGET
#define GRPC_ARG_OPTIMIZATION_TARGET
Definition: grpc_types.h:386
GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM
@ GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM
Definition: src/core/ext/transport/chttp2/transport/internal.h:116
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API()
Definition: stats_data.h:269
string.h
remove_stream
static void remove_stream(grpc_chttp2_transport *t, uint32_t id, grpc_error_handle error)
Definition: chttp2_transport.cc:2044
options
double_dict options[]
Definition: capstone_test.c:55
grpc_core::internal::StatusAllocHeapPtr
uintptr_t StatusAllocHeapPtr(absl::Status s)
Definition: status_helper.cc:421
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING()
Definition: stats_data.h:257
grpc_core::RefCountedPtr::reset
void reset(T *value=nullptr)
Definition: ref_counted_ptr.h:111
send_ping_locked
static void send_ping_locked(grpc_chttp2_transport *t, grpc_closure *on_initiate, grpc_closure *on_ack)
Definition: chttp2_transport.cc:1633
GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE
#define GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE()
Definition: stats_data.h:220
grpc_chttp2_transport::stream_map
grpc_chttp2_stream_map stream_map
Definition: src/core/ext/transport/chttp2/transport/internal.h:272
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_slice_buffer::slices
grpc_slice * slices
Definition: include/grpc/impl/codegen/slice.h:89
GRPC_CHTTP2_PCL_INFLIGHT
@ GRPC_CHTTP2_PCL_INFLIGHT
Definition: src/core/ext/transport/chttp2/transport/internal.h:103
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
grpc_chttp2_stream::recv_initial_metadata_ready
grpc_closure * recv_initial_metadata_ready
Definition: src/core/ext/transport/chttp2/transport/internal.h:499
grpc_integer_options
Definition: channel_args.h:310
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
g_default_client_keepalive_timeout_ms
static int g_default_client_keepalive_timeout_ms
Definition: chttp2_transport.cc:122
grpc_chttp2_add_ping_strike
void grpc_chttp2_add_ping_strike(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:1845
GRPC_DTS_CLIENT_PREFIX_0
@ GRPC_DTS_CLIENT_PREFIX_0
Definition: src/core/ext/transport/chttp2/transport/internal.h:157
grpc_endpoint_read
void grpc_endpoint_read(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool urgent, int min_progress_size)
Definition: endpoint.cc:25
useful.h
GRPC_SLICE_MALLOC
#define GRPC_SLICE_MALLOC(len)
Definition: include/grpc/slice.h:70
add_closure_barrier
static grpc_closure * add_closure_barrier(grpc_closure *closure)
Definition: chttp2_transport.cc:1230
GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE
@ GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE
Definition: src/core/ext/transport/chttp2/transport/internal.h:123
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS()
Definition: stats_data.h:278
grpc_chttp2_add_incoming_goaway
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport *t, uint32_t goaway_error, uint32_t last_stream_id, absl::string_view goaway_text)
Definition: chttp2_transport.cc:1099
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::GrpcMessageMetadata
Definition: metadata_batch.h:220
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_chttp2_transport::qbuf
grpc_slice_buffer qbuf
Definition: src/core/ext/transport/chttp2/transport/internal.h:304
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
next_bdp_ping_timer_expired_locked
static void next_bdp_ping_timer_expired_locked(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2693
grpc_endpoint_get_peer
absl::string_view grpc_endpoint_get_peer(grpc_endpoint *ep)
Definition: endpoint.cc:55
error_ref_leak.err
err
Definition: error_ref_leak.py:35
grpc_chttp2_transport::write_cb_pool
grpc_chttp2_write_cb * write_cb_pool
Definition: src/core/ext/transport/chttp2/transport/internal.h:382
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED
@ GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED
Definition: src/core/ext/transport/chttp2/transport/internal.h:127
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED()
Definition: stats_data.h:299
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE()
Definition: stats_data.h:242
null_then_sched_closure
static void null_then_sched_closure(grpc_closure **closure)
Definition: chttp2_transport.cc:1235
GRPC_CHANNEL_TRANSIENT_FAILURE
@ GRPC_CHANNEL_TRANSIENT_FAILURE
Definition: include/grpc/impl/codegen/connectivity_state.h:38
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM()
Definition: stats_data.h:245
UINT32_MAX
#define UINT32_MAX
Definition: stdint-msvc2008.h:142
arena.h
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING()
Definition: stats_data.h:293
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
grpc_http_trace
grpc_core::TraceFlag grpc_http_trace(false, "http")
u
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:351
GRPC_CHTTP2_PCL_INITIATE
@ GRPC_CHTTP2_PCL_INITIATE
Definition: src/core/ext/transport/chttp2/transport/internal.h:101
GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA
#define GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA()
Definition: stats_data.h:222
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(desc, errs, count)
Definition: error.h:307
GRPC_CHTTP2_DATA_FLAG_END_HEADERS
#define GRPC_CHTTP2_DATA_FLAG_END_HEADERS
Definition: frame.h:39
GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS
@ GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:120
DEFAULT_MAX_PENDING_INDUCED_FRAMES
#define DEFAULT_MAX_PENDING_INDUCED_FRAMES
Definition: chttp2_transport.cc:118
status
absl::Status status
Definition: rls.cc:251
grpc_chttp2_maybe_complete_recv_initial_metadata
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:1934
GRPC_ARG_ENABLE_CHANNELZ
#define GRPC_ARG_ENABLE_CHANNELZ
Definition: grpc_types.h:323
setup.name
name
Definition: setup.py:542
frame_data.h
grpc_resource_quota_trace
grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota")
GRPC_CHTTP2_STREAM_UNREF
#define GRPC_CHTTP2_STREAM_UNREF(stream, reason)
Definition: src/core/ext/transport/chttp2/transport/internal.h:700
grpc_transport_stream_op_batch_payload::send_initial_metadata
grpc_metadata_batch * send_initial_metadata
Definition: transport.h:346
GRPC_STATS_INC_HTTP2_PARTIAL_WRITES
#define GRPC_STATS_INC_HTTP2_PARTIAL_WRITES()
Definition: stats_data.h:240
grpc_core::Timestamp::InfPast
static constexpr Timestamp InfPast()
Definition: src/core/lib/gprpp/time.h:83
GRPC_CHTTP2_UNREF_TRANSPORT
#define GRPC_CHTTP2_UNREF_TRANSPORT(t, r)
Definition: src/core/ext/transport/chttp2/transport/internal.h:715
absl::FormatConversionChar::s
@ s
grpc_core::ContextList::Execute
static void Execute(void *arg, Timestamps *ts, grpc_error_handle error)
Definition: context_list.cc:47
grpc_trace_chttp2_refcount
grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false, "chttp2_refcount")
GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA
@ GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA
Definition: src/core/ext/transport/chttp2/transport/internal.h:111
on_timer_
grpc_closure on_timer_
Definition: outlier_detection.cc:377
grpc_chttp2_stream::grpc_chttp2_stream
grpc_chttp2_stream(grpc_chttp2_transport *t, grpc_stream_refcount *refcount, const void *server_data, grpc_core::Arena *arena)
Definition: chttp2_transport.cc:679
GRPC_ERROR_STR_RAW_BYTES
@ GRPC_ERROR_STR_RAW_BYTES
hex dump (or similar) with the data that generated this error
Definition: error.h:123
xds_manager.p
p
Definition: xds_manager.py:60
GRPC_CLOSURE_CREATE
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)
Definition: closure.h:160
grpc_core::chttp2::FlowControlAction::Urgency::NO_ACTION_NEEDED
@ NO_ACTION_NEEDED
GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
@ GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
Definition: http2_settings.h:29
GRPC_ERROR_CANCELLED
#define GRPC_ERROR_CANCELLED
Definition: error.h:238
GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT
@ GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT
Definition: src/core/ext/transport/chttp2/transport/internal.h:115
GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
@ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
Definition: http2_settings.h:31
grpc_chttp2_server_ping_recv_state::ping_strikes
int ping_strikes
Definition: src/core/ext/transport/chttp2/transport/internal.h:152
GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM
@ GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM
Definition: src/core/ext/transport/chttp2/transport/internal.h:129
get_vtable
static const grpc_transport_vtable * get_vtable(void)
Definition: chttp2_transport.cc:3113
grpc_timer
Definition: iomgr/timer.h:33
GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA
#define GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA()
Definition: stats_data.h:228
cancel_stream_cb_args
Definition: chttp2_transport.cc:2406
grpc_core::TestOnlySetGlobalHttp2TransportInitCallback
void TestOnlySetGlobalHttp2TransportInitCallback(TestOnlyGlobalHttp2TransportInitCallback callback)
Definition: chttp2_transport.cc:212
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL()
Definition: stats_data.h:275
status_helper.h
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
g_default_max_ping_strikes
static int g_default_max_ping_strikes
Definition: chttp2_transport.cc:136
grpc_core::Arena
Definition: src/core/lib/resource_quota/arena.h:45
GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA
@ GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA
Definition: http2_settings.h:35
grpc_chttp2_repeated_ping_state::is_delayed_ping_timer_set
bool is_delayed_ping_timer_set
Definition: src/core/ext/transport/chttp2/transport/internal.h:148
grpc_channel_args_find_bool
bool grpc_channel_args_find_bool(const grpc_channel_args *args, const char *name, bool default_value)
Definition: channel_args.cc:465
set_pollset
static void set_pollset(grpc_transport *gt, grpc_stream *, grpc_pollset *pollset)
Definition: chttp2_transport.cc:2926
grpc_channel_args
Definition: grpc_types.h:132
GRPC_TRACE_FLAG_ENABLED
#define GRPC_TRACE_FLAG_ENABLED(f)
Definition: debug/trace.h:114
GRPC_CHTTP2_GRACEFUL_GOAWAY
@ GRPC_CHTTP2_GRACEFUL_GOAWAY
Definition: src/core/ext/transport/chttp2/transport/internal.h:220
write_action
static void write_action(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:987
grpc_chttp2_stream::recv_trailing_metadata_finished
grpc_closure * recv_trailing_metadata_finished
Definition: src/core/ext/transport/chttp2/transport/internal.h:506
finish_keepalive_ping_locked
static void finish_keepalive_ping_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2845
continue_read_action_locked
static void continue_read_action_locked(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:2602
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
grpc_chttp2_parsing_become_skip_parser
void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport *t)
Definition: parsing.cc:377
stats.h
grpc_chttp2_stream::read_closed_error
grpc_error_handle read_closed_error
Definition: src/core/ext/transport/chttp2/transport/internal.h:529
GRPC_CHTTP2_NO_GOAWAY_SEND
@ GRPC_CHTTP2_NO_GOAWAY_SEND
Definition: src/core/ext/transport/chttp2/transport/internal.h:219
write_action_end_locked
static void write_action_end_locked(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:1020
GRPC_CHTTP2_FRAME_HEADER
#define GRPC_CHTTP2_FRAME_HEADER
Definition: frame.h:29
try_http_parsing
static grpc_error_handle try_http_parsing(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:2476
true
#define true
Definition: setup_once.h:324
grpc_transport_op
Definition: transport.h:452
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
grpc_connectivity_state
grpc_connectivity_state
Definition: include/grpc/impl/codegen/connectivity_state.h:30
grpc_chttp2_stream
Definition: src/core/ext/transport/chttp2/transport/internal.h:456
grpc_closure_list_append
bool grpc_closure_list_append(grpc_closure_list *closure_list, grpc_closure *closure)
Definition: closure.h:176
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext::MakeAction
FlowControlAction MakeAction()
Definition: flow_control.h:308
grpc_chttp2_ack_ping
void grpc_chttp2_ack_ping(grpc_chttp2_transport *t, uint64_t id)
Definition: chttp2_transport.cc:1704
GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED
@ GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED
Definition: src/core/ext/transport/chttp2/transport/internal.h:235
grpc_chttp2_transport::accepting_stream
grpc_chttp2_stream ** accepting_stream
Definition: src/core/ext/transport/chttp2/transport/internal.h:286
grpc_error_set_str
grpc_error_handle grpc_error_set_str(grpc_error_handle src, grpc_error_strs which, absl::string_view str)
Definition: error.cc:650
removal_error
static grpc_error_handle removal_error(grpc_error_handle extra_error, grpc_chttp2_stream *s, const char *main_error_msg)
Definition: chttp2_transport.cc:2139
grpc_core::BitSet::is_set
constexpr bool is_set(int i) const
Definition: bitset.h:112
grpc_chttp2_transport::flow_control
grpc_core::chttp2::TransportFlowControl flow_control
Definition: src/core/ext/transport/chttp2/transport/internal.h:359
grpc_chttp2_stream::read_closed
bool read_closed
Definition: src/core/ext/transport/chttp2/transport/internal.h:514
init_keepalive_ping
static void init_keepalive_ping(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2770
status.h
grpc_slice_buffer_tiny_add
GPRAPI uint8_t * grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t len)
Definition: slice/slice_buffer.cc:134
grpc_core::chttp2::TransportFlowControl::PeriodicUpdate
FlowControlAction PeriodicUpdate()
Definition: flow_control.cc:229
GRPC_ERROR_STR_TARGET_ADDRESS
@ GRPC_ERROR_STR_TARGET_ADDRESS
peer that we were trying to communicate when this error occurred
Definition: error.h:117
GRPC_ENABLE_CHANNELZ_DEFAULT
#define GRPC_ENABLE_CHANNELZ_DEFAULT
Definition: channelz.h:57
grpc_chttp2_stream_unref
void grpc_chttp2_stream_unref(grpc_chttp2_stream *s, const char *reason)
Definition: chttp2_transport.cc:659
grpc_chttp2_server_ping_recv_state::last_ping_recv_time
grpc_core::Timestamp last_ping_recv_time
Definition: src/core/ext/transport/chttp2/transport/internal.h:151
grpc_channel_arg_get_bool
bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value)
Definition: channel_args.cc:447
grpc_chttp2_mark_stream_writable
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:931
GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER
Definition: grpc_types.h:197
GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
@ GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
Definition: src/core/ext/transport/chttp2/transport/internal.h:92
GRPC_CHTTP2_PCL_COUNT
@ GRPC_CHTTP2_PCL_COUNT
Definition: src/core/ext/transport/chttp2/transport/internal.h:104
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED
@ GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED
Definition: src/core/ext/transport/chttp2/transport/internal.h:221
write_action_begin_locked
static void write_action_begin_locked(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:947
write_action_end
static void write_action_end(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:1011
grpc_chttp2_stream_map_add
void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map *map, uint32_t key, void *value)
Definition: stream_map.cc:59
grpc_chttp2_transport::grpc_chttp2_transport
grpc_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client)
Definition: chttp2_transport.cc:483
grpc_chttp2_initiate_write_reason
grpc_chttp2_initiate_write_reason
Definition: src/core/ext/transport/chttp2/transport/internal.h:107
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
grpc_chttp2_stream_ref
void grpc_chttp2_stream_ref(grpc_chttp2_stream *s, const char *reason)
Definition: chttp2_transport.cc:656
grpc_chttp2_initiate_write_reason_string
const char * grpc_chttp2_initiate_write_reason_string(grpc_chttp2_initiate_write_reason reason)
Definition: chttp2_transport.cc:3046
grpc_timer_init_unset
void grpc_timer_init_unset(grpc_timer *timer)
Definition: timer_generic.cc:330
cancel_pings
static void cancel_pings(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: chttp2_transport.cc:1621
grpc_http_response
Definition: src/core/lib/http/parser.h:85
GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA
@ GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA
Definition: src/core/ext/transport/chttp2/transport/internal.h:112
refcount
size_t refcount
Definition: abseil-cpp/absl/strings/internal/cordz_info.cc:122
grpc_error_add_child
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
Definition: error.cc:678
grpc_core::TestOnlyGlobalHttp2TransportInitCallback
void(* TestOnlyGlobalHttp2TransportInitCallback)()
Definition: chttp2_transport.h:58
grpc_combiner_create
grpc_core::Combiner * grpc_combiner_create(void)
Definition: combiner.cc:54
refs
std::vector< CordRep * > refs
Definition: cordz_info_statistics_test.cc:81
MAX_CLIENT_STREAM_ID
#define MAX_CLIENT_STREAM_ID
Definition: chttp2_transport.cc:138
http2_settings.h
DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS
#define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS
Definition: chttp2_transport.cc:108
grpc_chttp2_goaway_append
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code, const grpc_slice &debug_data, grpc_slice_buffer *slice_buffer)
Definition: frame_goaway.cc:155
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
grpc_chttp2_transport::base
grpc_transport base
Definition: src/core/ext/transport/chttp2/transport/internal.h:243
asyncio_get_stats.parser
parser
Definition: asyncio_get_stats.py:34
grpc_chttp2_config_default_keepalive_args
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args *args, bool is_client)
Definition: chttp2_transport.cc:2711
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
perform_stream_op
static void perform_stream_op(grpc_transport *gt, grpc_stream *gs, grpc_transport_stream_op_batch *op)
Definition: chttp2_transport.cc:1590
GRPC_STATUS_OK
@ GRPC_STATUS_OK
Definition: include/grpc/impl/codegen/status.h:30
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL()
Definition: stats_data.h:272
errors
const char * errors
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:841
grpc_core::RefCountedPtr< grpc_core::channelz::SocketNode >
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
close_transport_locked
static void close_transport_locked(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: chttp2_transport.cc:591
GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING
@ GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING
Definition: src/core/ext/transport/chttp2/transport/internal.h:126
grpc_status
Definition: src/python/grpcio_status/grpc_status/__init__.py:1
grpc_closure::next_data
union grpc_closure::@14 next_data
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
grpc_chttp2_list_add_writable_stream
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:143
grpc_chttp2_stream::destroy_stream_arg
grpc_closure * destroy_stream_arg
Definition: src/core/ext/transport/chttp2/transport/internal.h:472
post_destructive_reclaimer
static void post_destructive_reclaimer(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:2962
absl::optional::has_value
constexpr bool has_value() const noexcept
Definition: abseil-cpp/absl/types/optional.h:461
grpc_chttp2_stream::recv_message_ready
grpc_closure * recv_message_ready
Definition: src/core/ext/transport/chttp2/transport/internal.h:504
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
grpc_chttp2_stream_map_find
void * grpc_chttp2_stream_map_find(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:145
GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM
@ GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM
Definition: src/core/ext/transport/chttp2/transport/internal.h:109
GRPC_CHTTP2_WRITE_STATE_WRITING
@ GRPC_CHTTP2_WRITE_STATE_WRITING
Definition: src/core/ext/transport/chttp2/transport/internal.h:91
grpc_chttp2_stream::frame_storage
grpc_slice_buffer frame_storage
Definition: src/core/ext/transport/chttp2/transport/internal.h:539
perform_transport_op
static void perform_transport_op(grpc_transport *gt, grpc_transport_op *op)
Definition: chttp2_transport.cc:1917
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT()
Definition: stats_data.h:263
GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
@ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
Definition: http2_settings.h:33
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING()
Definition: stats_data.h:296
GRPC_ARG_HTTP2_MAX_FRAME_SIZE
#define GRPC_ARG_HTTP2_MAX_FRAME_SIZE
Definition: grpc_types.h:202
grpc_chttp2_list_add_waiting_for_concurrency
void grpc_chttp2_list_add_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:173
grpc_core::slice_detail::CopyConstructors< Slice >::FromCopiedBuffer
static Slice FromCopiedBuffer(const char *p, size_t len)
Definition: src/core/lib/slice/slice.h:182
grpc_core::SliceBuffer::c_slice_buffer
grpc_slice_buffer * c_slice_buffer()
Return a pointer to the back raw grpc_slice_buffer.
Definition: src/core/lib/slice/slice_buffer.h:117
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS()
Definition: stats_data.h:260
DEFAULT_CLIENT_KEEPALIVE_TIME_MS
#define DEFAULT_CLIENT_KEEPALIVE_TIME_MS
Definition: chttp2_transport.cc:107
grpc_core::channelz::SocketNode::RecordStreamFailed
void RecordStreamFailed()
Definition: channelz.h:323
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext
Definition: flow_control.h:303
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
cancel_stream_cb
static void cancel_stream_cb(void *user_data, uint32_t, void *stream)
Definition: chttp2_transport.cc:2411
retry_initiate_ping_locked
static void retry_initiate_ping_locked(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:1695
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
grpc_chttp2_stream::initial_metadata_buffer
grpc_metadata_batch initial_metadata_buffer
Definition: src/core/ext/transport/chttp2/transport/internal.h:536
grpc_closure::error
uintptr_t error
Definition: closure.h:75
transport
grpc_transport transport
Definition: filter_fuzzer.cc:146
add_error
static void add_error(grpc_error_handle error, grpc_error_handle *refs, size_t *nrefs)
Definition: chttp2_transport.cc:2127
grpc_chttp2_stream_map_for_each
void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, void(*f)(void *user_data, uint32_t key, void *value), void *user_data)
Definition: stream_map.cc:166
contains_non_ok_status
static bool contains_non_ok_status(grpc_metadata_batch *batch)
Definition: chttp2_transport.cc:1313
GPR_UNLIKELY
#define GPR_UNLIKELY(x)
Definition: impl/codegen/port_platform.h:770
closure
grpc_closure closure
Definition: src/core/lib/surface/server.cc:466
GRPC_CHTTP2_FINAL_GOAWAY_SENT
@ GRPC_CHTTP2_FINAL_GOAWAY_SENT
Definition: src/core/ext/transport/chttp2/transport/internal.h:222
grpc_core::chttp2::StreamFlowControl::IncomingUpdateContext::SetMinProgressSize
void SetMinProgressSize(uint32_t min_progress_size)
Definition: flow_control.h:316
grpc_chttp2_transport::is_client
bool is_client
Definition: src/core/ext/transport/chttp2/transport/internal.h:301
read_channel_args
static void read_channel_args(grpc_chttp2_transport *t, const grpc_channel_args *channel_args, bool is_client)
Definition: chttp2_transport.cc:288
absl::Status::SetPayload
void SetPayload(absl::string_view type_url, absl::Cord payload)
Definition: third_party/abseil-cpp/absl/status/status.cc:128
send_keepalive_ping_locked
static void send_keepalive_ping_locked(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:1652
GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING
@ GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING
Definition: src/core/ext/transport/chttp2/transport/internal.h:113
grpc_chttp2_transport::goaway_parser
grpc_chttp2_goaway_parser goaway_parser
Definition: src/core/ext/transport/chttp2/transport/internal.h:357
connectivity_state.h
grpc_chttp2_transport::ping_recv_state
grpc_chttp2_server_ping_recv_state ping_recv_state
Definition: src/core/ext/transport/chttp2/transport/internal.h:345
grpc_chttp2_act_on_flowctl_action
void grpc_chttp2_act_on_flowctl_action(const grpc_core::chttp2::FlowControlAction &action, grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:2452
grpc_transport_stream_op_batch_payload::cancel_error
grpc_error_handle cancel_error
Definition: transport.h:444
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
GRPC_DTS_FH_0
@ GRPC_DTS_FH_0
Definition: src/core/ext/transport/chttp2/transport/internal.h:183
log_metadata
static void log_metadata(const grpc_metadata_batch *md_batch, uint32_t id, bool is_client, bool is_initial)
Definition: chttp2_transport.cc:1318
GRPC_WRITE_BUFFER_HINT
#define GRPC_WRITE_BUFFER_HINT
Definition: grpc_types.h:510
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
grpc_closure::scratch
uintptr_t scratch
Definition: closure.h:64
connectivity_state_set
static void connectivity_state_set(grpc_chttp2_transport *t, grpc_connectivity_state state, const absl::Status &status, const char *reason)
Definition: chttp2_transport.cc:2913
GRPC_HEADER_SIZE_IN_BYTES
#define GRPC_HEADER_SIZE_IN_BYTES
Definition: src/core/ext/transport/chttp2/transport/internal.h:672
frame_goaway.h
grpc_chttp2_stream::write_closed
bool write_closed
Definition: src/core/ext/transport/chttp2/transport/internal.h:512
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
slice_buffer.h
grpc_channel_args::num_args
size_t num_args
Definition: grpc_types.h:133
grpc_chttp2_transport::goaway_error
grpc_error_handle goaway_error
Definition: src/core/ext/transport/chttp2/transport/internal.h:312
arg
Definition: cmdline.cc:40
grpc_error_get_int
bool grpc_error_get_int(grpc_error_handle err, grpc_error_ints which, intptr_t *p)
Definition: error.cc:635
GRPC_WRITE_THROUGH
#define GRPC_WRITE_THROUGH
Definition: grpc_types.h:515
vtable
static const grpc_transport_vtable vtable
Definition: chttp2_transport.cc:3101
grpc_chttp2_stream::eos_received
bool eos_received
Definition: src/core/ext/transport/chttp2/transport/internal.h:525
std::swap
void swap(Json::Value &a, Json::Value &b)
Specialize std::swap() for Json::Value.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:1226
grpc_transport_stream_op_batch_payload::send_trailing_metadata
grpc_metadata_batch * send_trailing_metadata
Definition: transport.h:359
time.h
grpc_empty_slice
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
gpr_atm_rel_store
#define gpr_atm_rel_store(p, value)
Definition: impl/codegen/atm_gcc_atomic.h:54
grpc_chttp2_list_pop_waiting_for_concurrency
bool grpc_chttp2_list_pop_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:178
grpc_chttp2_transport::~grpc_chttp2_transport
~grpc_chttp2_transport()
Definition: chttp2_transport.cc:233
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
grpc_chttp2_transport::closed_with_error
grpc_error_handle closed_with_error
Definition: src/core/ext/transport/chttp2/transport/internal.h:263
read_action_locked
static void read_action_locked(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:2512
finish_bdp_ping
static void finish_bdp_ping(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2647
grpc_stream_ref
void grpc_stream_ref(grpc_stream_refcount *refcount, const char *reason)
Definition: transport.h:203
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
grpc_chttp2_stream
struct grpc_chttp2_stream grpc_chttp2_stream
Definition: frame.h:25
GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA
Definition: grpc_types.h:226
grpc_chttp2_stream_map_delete
void * grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:129
grpc_http_response_destroy
void grpc_http_response_destroy(grpc_http_response *response)
Definition: src/core/lib/http/parser.cc:434
grpc_core::TestOnlyGlobalHttp2TransportDisableTransientFailureStateNotification
void TestOnlyGlobalHttp2TransportDisableTransientFailureStateNotification(bool disable)
Definition: chttp2_transport.cc:222
error.h
grpc_core::VarintWriter::Write
void Write(uint8_t prefix, uint8_t *target) const
Definition: varint.h:56
grpc_chttp2_setting_parameters::max_value
uint32_t max_value
Definition: http2_settings.h:53
grpc_chttp2_list_remove_stalled_by_transport
void grpc_chttp2_list_remove_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:198
grpc_chttp2_stream::send_trailing_metadata_finished
grpc_closure * send_trailing_metadata_finished
Definition: src/core/ext/transport/chttp2/transport/internal.h:491
grpc_core::SliceBuffer::Length
size_t Length() const
The total number of bytes held by the SliceBuffer.
Definition: src/core/lib/slice/slice_buffer.h:97
grpc_endpoint_shutdown
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
Definition: endpoint.cc:49
init_keepalive_ping_locked
static void init_keepalive_ping_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2777
callback
static void callback(void *arg, int status, int timeouts, struct hostent *host)
Definition: acountry.c:224
GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES
#define GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES
Definition: grpc_types.h:192
batch
grpc_transport_stream_op_batch * batch
Definition: retry_filter.cc:243
grpc_http_parser_destroy
void grpc_http_parser_destroy(grpc_http_parser *)
Definition: src/core/lib/http/parser.cc:420
grpc_chttp2_stream_map_rand
void * grpc_chttp2_stream_map_rand(grpc_chttp2_stream_map *map)
Definition: stream_map.cc:154
grpc_chttp2_setting_parameters::name
const char * name
Definition: http2_settings.h:50
uintptr_t
_W64 unsigned int uintptr_t
Definition: stdint-msvc2008.h:119
slice_internal.h
trace.h
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
GPR_UNREACHABLE_CODE
#define GPR_UNREACHABLE_CODE(STATEMENT)
Definition: impl/codegen/port_platform.h:652
min
#define min(a, b)
Definition: qsort.h:83
grpc_core::RefCounted
Definition: ref_counted.h:280
GRPC_SLICE_END_PTR
#define GRPC_SLICE_END_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:110
keepalive_watchdog_fired
static void keepalive_watchdog_fired(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2876
grpc_endpoint_destroy
void grpc_endpoint_destroy(grpc_endpoint *ep)
Definition: endpoint.cc:53
grpc_core::chttp2::FlowControlAction
Definition: flow_control.h:71
resource_quota.h
GRPC_METADATA_PUBLISHED_FROM_WIRE
@ GRPC_METADATA_PUBLISHED_FROM_WIRE
Definition: src/core/ext/transport/chttp2/transport/internal.h:452
GRPC_CHTTP2_KEEPALIVE_STATE_DYING
@ GRPC_CHTTP2_KEEPALIVE_STATE_DYING
Definition: src/core/ext/transport/chttp2/transport/internal.h:234
grpc_chttp2_setting_id
grpc_chttp2_setting_id
Definition: http2_settings.h:28
GRPC_CHTTP2_PCL_NEXT
@ GRPC_CHTTP2_PCL_NEXT
Definition: src/core/ext/transport/chttp2/transport/internal.h:102
GRPC_METADATA_PUBLISHED_AT_CLOSE
@ GRPC_METADATA_PUBLISHED_AT_CLOSE
Definition: src/core/ext/transport/chttp2/transport/internal.h:453
schedule_bdp_ping_locked
void schedule_bdp_ping_locked(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:2612
grpc_core::GrpcStatusMetadata
Definition: metadata_batch.h:293
F
#define F(b, c, d)
Definition: md4.c:112
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
GRPC_PEER_SETTINGS
@ GRPC_PEER_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:208
grpc_core::GrpcStreamNetworkState::kNotSentOnWire
@ kNotSentOnWire
Definition: metadata_batch.h:369
write_state_name
static const char * write_state_name(grpc_chttp2_write_state st)
Definition: chttp2_transport.cc:784
grpc_chttp2_begin_write_result
Definition: src/core/ext/transport/chttp2/transport/internal.h:584
grpc_slice_buffer_init
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:116
GRPC_LOCAL_SETTINGS
@ GRPC_LOCAL_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:210
stream_map.h
destroy_stream_locked
static void destroy_stream_locked(void *sp, grpc_error_handle)
Definition: chttp2_transport.cc:748
bdp_estimator.h
GRPC_ARG_KEEPALIVE_TIMEOUT_MS
#define GRPC_ARG_KEEPALIVE_TIMEOUT_MS
Definition: grpc_types.h:244
grpc_core::channelz::SocketNode::RecordStreamSucceeded
void RecordStreamSucceeded()
Definition: channelz.h:320
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
grpc_core::channelz::SocketNode::Security::GetFromChannelArgs
static RefCountedPtr< Security > GetFromChannelArgs(const grpc_channel_args *args)
Definition: src/core/lib/channel/channelz.cc:411
grpc_chttp2_stream_map_size
size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map *map)
Definition: stream_map.cc:150
grpc_chttp2_stream::~grpc_chttp2_stream
~grpc_chttp2_stream()
Definition: chttp2_transport.cc:700
GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING
@ GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING
Definition: src/core/ext/transport/chttp2/transport/internal.h:122
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
grpc_core::TraceFlag
Definition: debug/trace.h:63
grpc_http2_status_to_grpc_status
grpc_status_code grpc_http2_status_to_grpc_status(int status)
Definition: status_conversion.cc:67
frame.h
GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS
@ GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:114
grpc_chttp2_list_remove_waiting_for_concurrency
void grpc_chttp2_list_remove_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:183
DEFAULT_MAX_PINGS_BETWEEN_DATA
#define DEFAULT_MAX_PINGS_BETWEEN_DATA
Definition: chttp2_transport.cc:115
grpc_chttp2_repeated_ping_state::last_ping_sent_time
grpc_core::Timestamp last_ping_sent_time
Definition: src/core/ext/transport/chttp2/transport/internal.h:145
grpc_chttp2_transport_get_socket_node
grpc_core::RefCountedPtr< grpc_core::channelz::SocketNode > grpc_chttp2_transport_get_socket_node(grpc_transport *transport)
Definition: chttp2_transport.cc:3116
value
const char * value
Definition: hpack_parser_table.cc:165
grpc_chttp2_setting_parameters::default_value
uint32_t default_value
Definition: http2_settings.h:51
cancel_stream_cb_args::t
grpc_chttp2_transport * t
Definition: chttp2_transport.cc:2408
GRPC_CHTTP2_REF_TRANSPORT
#define GRPC_CHTTP2_REF_TRANSPORT(t, r)
Definition: src/core/ext/transport/chttp2/transport/internal.h:713
grpc_chttp2_stream::send_initial_metadata_finished
grpc_closure * send_initial_metadata_finished
Definition: src/core/ext/transport/chttp2/transport/internal.h:482
set_write_state
static void set_write_state(grpc_chttp2_transport *t, grpc_chttp2_write_state st, const char *reason)
Definition: chttp2_transport.cc:796
grpc_transport_stream_op_batch_string
std::string grpc_transport_stream_op_batch_string(grpc_transport_stream_op_batch *op)
Definition: transport_op_string.cc:44
gpr_atm
intptr_t gpr_atm
Definition: impl/codegen/atm_gcc_atomic.h:32
grpc_transport_stream_op_batch_payload
Definition: transport.h:341
keepalive_watchdog_fired_locked
static void keepalive_watchdog_fired_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2884
g_default_max_pings_without_data
static int g_default_max_pings_without_data
Definition: chttp2_transport.cc:135
grpc_timer_cancel
void grpc_timer_cancel(grpc_timer *timer)
Definition: iomgr/timer.cc:36
grpc_core::Duration::Milliseconds
static constexpr Duration Milliseconds(int64_t millis)
Definition: src/core/lib/gprpp/time.h:155
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING()
Definition: stats_data.h:287
absl::Now
ABSL_NAMESPACE_BEGIN Time Now()
Definition: abseil-cpp/absl/time/clock.cc:39
grpc_chttp2_list_remove_stalled_by_stream
bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:213
grpc_chttp2_end_write
void grpc_chttp2_end_write(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: writing.cc:674
GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE
#define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE
Definition: grpc_types.h:234
GPR_ARRAY_SIZE
#define GPR_ARRAY_SIZE(array)
Definition: useful.h:129
grpc_slice_buffer_add
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
Definition: slice/slice_buffer.cc:170
g_default_server_keepalive_permit_without_calls
static bool g_default_server_keepalive_permit_without_calls
Definition: chttp2_transport.cc:130
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM()
Definition: stats_data.h:266
parser.h
grpc_chttp2_transport::settings
uint32_t settings[GRPC_NUM_SETTING_SETS][GRPC_CHTTP2_NUM_SETTINGS]
Definition: src/core/ext/transport/chttp2/transport/internal.h:325
grpc_core::Clamp
T Clamp(T val, T min, T max)
Definition: useful.h:31
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
GRPC_WRITE_INTERNAL_COMPRESS
#define GRPC_WRITE_INTERNAL_COMPRESS
Definition: transport.h:75
debug_location.h
finish_keepalive_ping
static void finish_keepalive_ping(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2838
grpc_core::ReclamationPass::kBenign
@ kBenign
key
const char * key
Definition: hpack_parser_table.cc:164
GRPC_CHTTP2_STREAM_REF
#define GRPC_CHTTP2_STREAM_REF(stream, reason)
Definition: src/core/ext/transport/chttp2/transport/internal.h:698
start_bdp_ping_locked
static void start_bdp_ping_locked(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2630
grpc_http2_error_code
grpc_http2_error_code
Definition: http2_errors.h:23
grpc_chttp2_stream::Reffer::Reffer
Reffer(grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:671
GRPC_CHTTP2_NUM_SETTINGS
#define GRPC_CHTTP2_NUM_SETTINGS
Definition: http2_settings.h:38
GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE
@ GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE
Definition: src/core/ext/transport/chttp2/transport/internal.h:128
grpc_chttp2_transport::ep
grpc_endpoint * ep
Definition: src/core/ext/transport/chttp2/transport/internal.h:245
client.action
action
Definition: examples/python/xds/client.py:49
grpc_error_set_int
grpc_error_handle grpc_error_set_int(grpc_error_handle src, grpc_error_ints which, intptr_t value)
Definition: error.cc:613
grpc_deframe_unprocessed_incoming_frames
grpc_core::Poll< grpc_error_handle > grpc_deframe_unprocessed_incoming_frames(grpc_chttp2_stream *s, uint32_t *min_progress_size, grpc_core::SliceBuffer *stream_out, uint32_t *message_flags)
Definition: frame_data.cc:82
grpc_core::ResourceQuotaFromChannelArgs
ResourceQuotaRefPtr ResourceQuotaFromChannelArgs(const grpc_channel_args *args)
Definition: api.cc:40
absl::flags_internal
Definition: abseil-cpp/absl/flags/commandlineflag.h:40
queue_setting_update
static void queue_setting_update(grpc_chttp2_transport *t, grpc_chttp2_setting_id id, uint32_t value)
Definition: chttp2_transport.cc:1071
benign_reclaimer_locked
static void benign_reclaimer_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2982
WithUrgency
static void WithUrgency(grpc_chttp2_transport *t, grpc_core::chttp2::FlowControlAction::Urgency urgency, grpc_chttp2_initiate_write_reason reason, F action)
Definition: chttp2_transport.cc:2437
ref_counted.h
GRPC_ARG_MAX_METADATA_SIZE
#define GRPC_ARG_MAX_METADATA_SIZE
Definition: grpc_types.h:293
grpc_chttp2_perform_read
grpc_error_handle grpc_chttp2_perform_read(grpc_chttp2_transport *t, const grpc_slice &slice)
Definition: parsing.cc:82
grpc_chttp2_stream::included
grpc_core::BitSet< STREAM_LIST_COUNT > included
Definition: src/core/ext/transport/chttp2/transport/internal.h:475
destroy_transport_locked
static void destroy_transport_locked(void *tp, grpc_error_handle)
Definition: chttp2_transport.cc:573
grpc_chttp2_transport
struct grpc_chttp2_transport grpc_chttp2_transport
Definition: frame.h:26
GRPC_CHTTP2_IF_TRACING
#define GRPC_CHTTP2_IF_TRACING(stmt)
Definition: src/core/ext/transport/chttp2/transport/internal.h:682
grpc_chttp2_stream_map_destroy
void grpc_chttp2_stream_map_destroy(grpc_chttp2_stream_map *map)
Definition: stream_map.cc:40
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
poll.h
grpc_core::PeerString
Definition: metadata_batch.h:376
grpc_chttp2_transport::channelz_socket
grpc_core::RefCountedPtr< grpc_core::channelz::SocketNode > channelz_socket
Definition: src/core/ext/transport/chttp2/transport/internal.h:438
grpc_transport::vtable
const grpc_transport_vtable * vtable
Definition: transport_impl.h:93
grpc_core::VarintWriter::length
uint32_t length() const
Definition: varint.h:54
GRPC_CHTTP2_CLIENT_CONNECT_STRING
#define GRPC_CHTTP2_CLIENT_CONNECT_STRING
Definition: src/core/ext/transport/chttp2/transport/internal.h:675
maybe_start_some_streams
static void maybe_start_some_streams(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:1170
grpc_chttp2_stream_map_init
void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map *map, size_t initial_capacity)
Definition: stream_map.cc:28
CLOSURE_BARRIER_MAY_COVER_WRITE
#define CLOSURE_BARRIER_MAY_COVER_WRITE
Definition: chttp2_transport.cc:1225
GRPC_NUM_SETTING_SETS
@ GRPC_NUM_SETTING_SETS
Definition: src/core/ext/transport/chttp2/transport/internal.h:215
GRPC_CHTTP2_DATA_FLAG_END_STREAM
#define GRPC_CHTTP2_DATA_FLAG_END_STREAM
Definition: frame.h:37
grpc_endpoint_add_to_pollset_set
void grpc_endpoint_add_to_pollset_set(grpc_endpoint *ep, grpc_pollset_set *pollset_set)
Definition: endpoint.cc:39
absl::Status
Definition: third_party/abseil-cpp/absl/status/status.h:424
grpc_closure::error_data
union grpc_closure::@15 error_data
GRPC_CHTTP2_SETTINGS_ENABLE_PUSH
@ GRPC_CHTTP2_SETTINGS_ENABLE_PUSH
Definition: http2_settings.h:30
grpc_chttp2_initiate_write
void grpc_chttp2_initiate_write(grpc_chttp2_transport *t, grpc_chttp2_initiate_write_reason reason)
Definition: chttp2_transport.cc:891
absl::str_format_internal::LengthMod::t
@ t
grpc_chttp2_transport::outbuf
grpc_slice_buffer outbuf
Definition: src/core/ext/transport/chttp2/transport/internal.h:297
grpc_chttp2_retry_initiate_ping
void grpc_chttp2_retry_initiate_ping(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:1688
grpc_transport_op_string
std::string grpc_transport_op_string(grpc_transport_op *op)
Definition: transport_op_string.cc:95
configure_transport_ping_policy
static void configure_transport_ping_policy(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:459
alloc.h
grpc_core::VarintWriter< 1 >
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA()
Definition: stats_data.h:251
grpc_error_has_clear_grpc_status
bool grpc_error_has_clear_grpc_status(grpc_error_handle error)
Definition: error_utils.cc:177
grpc_core::SliceBuffer::Count
size_t Count() const
Returns the number of slices held by the SliceBuffer.
Definition: src/core/lib/slice/slice_buffer.h:71
grpc_chttp2_write_state
grpc_chttp2_write_state
Definition: src/core/ext/transport/chttp2/transport/internal.h:89
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
grpc_core::chttp2::FlowControlAction::Urgency
Urgency
Definition: flow_control.h:73
DEFAULT_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS
#define DEFAULT_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS
Definition: chttp2_transport.cc:114
g_default_client_keepalive_permit_without_calls
static bool g_default_client_keepalive_permit_without_calls
Definition: chttp2_transport.cc:128
fix_build_deps.r
r
Definition: fix_build_deps.py:491
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
grpc_core::GrpcStreamNetworkState
Definition: metadata_batch.h:365
grpc_arg::key
char * key
Definition: grpc_types.h:105
grpc_chttp2_transport::ping_acks
uint64_t * ping_acks
Definition: src/core/ext/transport/chttp2/transport/internal.h:344
grpc_transport_stream_op_batch_payload::send_message
grpc_core::SliceBuffer * send_message
Definition: transport.h:373
GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY
#define GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY
Definition: grpc_types.h:237
grpc_core::Duration::Seconds
static constexpr Duration Seconds(int64_t seconds)
Definition: src/core/lib/gprpp/time.h:151
flow_control.h
chttp2_transport.h
grpc_transport_stream_op_batch_payload::recv_initial_metadata
grpc_metadata_batch * recv_initial_metadata
Definition: transport.h:390
GRPC_ARG_HTTP2_BDP_PROBE
#define GRPC_ARG_HTTP2_BDP_PROBE
Definition: grpc_types.h:204
grpc_http_parser_parse
grpc_error_handle grpc_http_parser_parse(grpc_http_parser *parser, const grpc_slice &slice, size_t *start_of_body)
Definition: src/core/lib/http/parser.cc:444
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
grpc_chttp2_ping_queue::inflight_id
uint64_t inflight_id
Definition: src/core/ext/transport/chttp2/transport/internal.h:137
slices
SliceBuffer * slices
Definition: retry_filter.cc:631
GRPC_CHTTP2_INITIATE_WRITE_SETTINGS_ACK
@ GRPC_CHTTP2_INITIATE_WRITE_SETTINGS_ACK
Definition: src/core/ext/transport/chttp2/transport/internal.h:121
combiner.h
grpc_chttp2_stream::refcount
grpc_stream_refcount * refcount
Definition: src/core/ext/transport/chttp2/transport/internal.h:463
grpc_http_parser_init
void grpc_http_parser_init(grpc_http_parser *parser, grpc_http_type type, void *request_or_response)
Definition: src/core/lib/http/parser.cc:411
grpc_chttp2_stream::write_closed_error
grpc_error_handle write_closed_error
Definition: src/core/ext/transport/chttp2/transport/internal.h:531
GRPC_CHTTP2_WRITE_STATE_IDLE
@ GRPC_CHTTP2_WRITE_STATE_IDLE
Definition: src/core/ext/transport/chttp2/transport/internal.h:90
http2_errors.h
grpc_chttp2_stream::flow_control
grpc_core::chttp2::StreamFlowControl flow_control
Definition: src/core/ext/transport/chttp2/transport/internal.h:554
grpc_chttp2_transport
Definition: src/core/ext/transport/chttp2/transport/internal.h:238
arg
struct arg arg
hpack_encoder.h
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
@ GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
Definition: http2_settings.h:32
grpc_transport_stream_op_batch_payload::recv_message
absl::optional< grpc_core::SliceBuffer > * recv_message
Definition: transport.h:416
exec_ctx.h
grpc_chttp2_cancel_stream
void grpc_chttp2_cancel_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error_handle due_to_error)
Definition: chttp2_transport.cc:2073
grpc_slice_from_cpp_string
grpc_slice grpc_slice_from_cpp_string(std::string str)
Definition: slice/slice.cc:202
desc
#define desc
Definition: bloaty/third_party/protobuf/src/google/protobuf/extension_set.h:338
grpc_timer_init
void grpc_timer_init(grpc_timer *timer, grpc_core::Timestamp deadline, grpc_closure *closure)
Definition: iomgr/timer.cc:31
slice_refcount.h
GRPC_STATS_INC_HTTP2_OP_CANCEL
#define GRPC_STATS_INC_HTTP2_OP_CANCEL()
Definition: stats_data.h:216
closure
Definition: proxy.cc:59
grpc_chttp2_mark_stream_closed
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport *t, grpc_chttp2_stream *s, int close_reads, int close_writes, grpc_error_handle error)
Definition: chttp2_transport.cc:2193
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE()
Definition: stats_data.h:248
grpc_chttp2_transport::ping_state
grpc_chttp2_repeated_ping_state ping_state
Definition: src/core/ext/transport/chttp2/transport/internal.h:337
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
grpc_core::ExecCtx::Run
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
Definition: exec_ctx.cc:98
KEEPALIVE_TIME_BACKOFF_MULTIPLIER
#define KEEPALIVE_TIME_BACKOFF_MULTIPLIER
Definition: chttp2_transport.cc:112
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE()
Definition: stats_data.h:302
GRPC_METADATA_NOT_PUBLISHED
@ GRPC_METADATA_NOT_PUBLISHED
Definition: src/core/ext/transport/chttp2/transport/internal.h:450
grpc_closure_list_fail_all
void grpc_closure_list_fail_all(grpc_closure_list *list, grpc_error_handle forced_failure)
Definition: closure.h:211
grpc_core::internal::StatusMoveFromHeapPtr
absl::Status StatusMoveFromHeapPtr(uintptr_t ptr)
Move the status from a heap ptr. (GetFrom & FreeHeap)
Definition: status_helper.cc:440
GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA
#define GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA()
Definition: stats_data.h:218
grpc_transport
Definition: transport_impl.h:89
transport.h
memory_quota.h
grpc_chttp2_add_rst_stream_to_next_write
void grpc_chttp2_add_rst_stream_to_next_write(grpc_chttp2_transport *t, uint32_t id, uint32_t code, grpc_transport_one_way_stats *stats)
Definition: frame_rst_stream.cc:67
g_default_server_keepalive_timeout_ms
static int g_default_server_keepalive_timeout_ms
Definition: chttp2_transport.cc:126
GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL
@ GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL
Definition: src/core/ext/transport/chttp2/transport/internal.h:118
set_pollset_set
static void set_pollset_set(grpc_transport *gt, grpc_stream *, grpc_pollset_set *pollset_set)
Definition: chttp2_transport.cc:2932
grpc_chttp2_goaway_parser_init
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser *p)
Definition: frame_goaway.cc:35
grpc_stream
struct grpc_stream grpc_stream
Definition: transport.h:174
channel_args.h
timer.h
grpc_chttp2_stream::flow_controlled_buffer
grpc_slice_buffer flow_controlled_buffer
Definition: src/core/ext/transport/chttp2/transport/internal.h:556
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM()
Definition: stats_data.h:305
GRPC_CHTTP2_INITIATE_WRITE_BDP_PING
@ GRPC_CHTTP2_INITIATE_WRITE_BDP_PING
Definition: src/core/ext/transport/chttp2/transport/internal.h:125
context_list.h
grpc_slice_buffer_destroy_internal
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:123
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE
#define GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(value)
Definition: stats_data.h:414
grpc_chttp2_stream::trailing_metadata_buffer
grpc_metadata_batch trailing_metadata_buffer
Definition: src/core/ext/transport/chttp2/transport/internal.h:537
flush_write_list
static void flush_write_list(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_chttp2_write_cb **list, grpc_error_handle error)
Definition: chttp2_transport.cc:2156
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
@ GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
Definition: http2_settings.h:34
start_keepalive_ping_locked
static void start_keepalive_ping_locked(void *arg, grpc_error_handle error)
Definition: chttp2_transport.cc:2817
close_from_api
static void close_from_api(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error_handle error)
Definition: chttp2_transport.cc:2247
grpc_chttp2_write_cb
Definition: src/core/ext/transport/chttp2/transport/internal.h:225
grpc_endpoint_write
void grpc_endpoint_write(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
Definition: endpoint.cc:30
GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS
#define GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS
Definition: grpc_types.h:247
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE
#define GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE()
Definition: stats_data.h:226
init_stream
static int init_stream(grpc_transport *gt, grpc_stream *gs, grpc_stream_refcount *refcount, const void *server_data, grpc_core::Arena *arena)
Definition: chttp2_transport.cc:739
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
post_benign_reclaimer
static void post_benign_reclaimer(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:2942
grpc_chttp2_settings_parameters
const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]
Definition: http2_settings.cc:46
grpc_error_get_status
void grpc_error_get_status(grpc_error_handle error, grpc_core::Timestamp deadline, grpc_status_code *code, std::string *message, grpc_http2_error_code *http_error, const char **error_string)
Definition: error_utils.cc:67
inc_initiate_write_reason
static void inc_initiate_write_reason(grpc_chttp2_initiate_write_reason reason)
Definition: chttp2_transport.cc:819
grpc_chttp2_list_pop_stalled_by_stream
bool grpc_chttp2_list_pop_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:208
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
grpc_core::Timestamp::InfFuture
static constexpr Timestamp InfFuture()
Definition: src/core/lib/gprpp/time.h:79
status_conversion.h
grpc_chttp2_fail_pending_writes
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error_handle error)
Definition: chttp2_transport.cc:2170
destroy_stream
static void destroy_stream(grpc_transport *gt, grpc_stream *gs, grpc_closure *then_schedule_closure)
Definition: chttp2_transport.cc:754
grpc_slice_buffer
Definition: include/grpc/impl/codegen/slice.h:83
GRPC_METADATA_SYNTHESIZED_FROM_FAKE
@ GRPC_METADATA_SYNTHESIZED_FROM_FAKE
Definition: src/core/ext/transport/chttp2/transport/internal.h:451
GRPC_CHANNEL_SHUTDOWN
@ GRPC_CHANNEL_SHUTDOWN
Definition: include/grpc/impl/codegen/connectivity_state.h:40
atm.h
transport_impl.h
grpc_transport_stream_op_batch_payload::recv_trailing_metadata
grpc_metadata_batch * recv_trailing_metadata
Definition: transport.h:425
grpc_chttp2_reset_ping_clock
void grpc_chttp2_reset_ping_clock(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:1861
GRPC_ERROR_INT_OCCURRED_DURING_WRITE
@ GRPC_ERROR_INT_OCCURRED_DURING_WRITE
chttp2: did the error occur while a write was in progress
Definition: error.h:91
grpc_chttp2_transport::cl
grpc_core::ContextList * cl
Definition: src/core/ext/transport/chttp2/transport/internal.h:437
GRPC_CHTTP2_KEEPALIVE_STATE_PINGING
@ GRPC_CHTTP2_KEEPALIVE_STATE_PINGING
Definition: src/core/ext/transport/chttp2/transport/internal.h:233
iomgr_fwd.h
GRPC_HTTP_RESPONSE
@ GRPC_HTTP_RESPONSE
Definition: src/core/lib/http/parser.h:64
GRPC_ERROR_INT_HTTP_STATUS
@ GRPC_ERROR_INT_HTTP_STATUS
HTTP status (i.e. 404)
Definition: error.h:88
grpc_core::ExecCtx::Now
Timestamp Now()
Definition: exec_ctx.cc:90
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
grpc_endpoint_get_local_address
absl::string_view grpc_endpoint_get_local_address(grpc_endpoint *ep)
Definition: endpoint.cc:59
GRPC_ARG_KEEPALIVE_TIME_MS
#define GRPC_ARG_KEEPALIVE_TIME_MS
Definition: grpc_types.h:240
absl::StatusCode::kUnavailable
@ kUnavailable
CLOSURE_BARRIER_FIRST_REF_BIT
#define CLOSURE_BARRIER_FIRST_REF_BIT
Definition: chttp2_transport.cc:1228
DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS
#define DEFAULT_KEEPALIVE_PERMIT_WITHOUT_CALLS
Definition: chttp2_transport.cc:111
grpc_error
Definition: error_internal.h:42
GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS
#define GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS
Definition: grpc_types.h:219
grpc_error_to_absl_status
absl::Status grpc_error_to_absl_status(grpc_error_handle error)
Definition: error_utils.cc:156
self
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:543
GRPC_STATS_INC_HTTP2_OP_BATCHES
#define GRPC_STATS_INC_HTTP2_OP_BATCHES()
Definition: stats_data.h:214
INT32_MAX
#define INT32_MAX
Definition: stdint-msvc2008.h:137
grpc_endpoint_add_to_pollset
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset)
Definition: endpoint.cc:35
grpc_chttp2_ping_queue
Definition: src/core/ext/transport/chttp2/transport/internal.h:135
grpc_metadata_batch
Definition: metadata_batch.h:1259
grpc_closure_list_empty
bool grpc_closure_list_empty(grpc_closure_list closure_list)
Definition: closure.h:243
grpc_chttp2_stream::reffer
struct grpc_chttp2_stream::Reffer reffer
grpc_chttp2_write_cb::next
struct grpc_chttp2_write_cb * next
Definition: src/core/ext/transport/chttp2/transport/internal.h:228
GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE
@ GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE
Definition: src/core/ext/transport/chttp2/transport/internal.h:110
grpc_pollset
Definition: bm_cq_multiple_threads.cc:37
read_action
static void read_action(void *t, grpc_error_handle error)
Definition: chttp2_transport.cc:2505
ABSL_FALLTHROUGH_INTENDED
#define ABSL_FALLTHROUGH_INTENDED
Definition: abseil-cpp/absl/base/attributes.h:641
DEFAULT_MAX_HEADER_LIST_SIZE
#define DEFAULT_MAX_HEADER_LIST_SIZE
Definition: chttp2_transport.cc:105
grpc_http_parser
Definition: src/core/lib/http/parser.h:99
GRPC_COMBINER_UNREF
#define GRPC_COMBINER_UNREF(combiner, reason)
Definition: combiner.h:71
grpc_transport_stream_op_batch
Definition: transport.h:284
frame_rst_stream.h
end_all_the_calls
static void end_all_the_calls(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: chttp2_transport.cc:2417
to_string
static bool to_string(zval *from)
Definition: protobuf/php/ext/google/protobuf/convert.c:333
GRPC_CHTTP2_CLIENT_CONNECT_STRLEN
#define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN
Definition: src/core/ext/transport/chttp2/transport/internal.h:676
grpc_channel_args::args
grpc_arg * args
Definition: grpc_types.h:134
grpc_closure
Definition: closure.h:56
finish_bdp_ping_locked
static void finish_bdp_ping_locked(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:2654
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
slice_buffer.h
perform_stream_op_locked
static void perform_stream_op_locked(void *stream_op, grpc_error_handle)
Definition: chttp2_transport.cc:1327
GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API
@ GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API
Definition: src/core/ext/transport/chttp2/transport/internal.h:117
grpc_stream_unref
void grpc_stream_unref(grpc_stream_refcount *refcount, const char *reason)
Definition: transport.h:220
GPR_TIMER_MARK
#define GPR_TIMER_MARK(tag, important)
Definition: src/core/lib/profiling/timers.h:39
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_BDP_ESTIMATOR_PING
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_BDP_ESTIMATOR_PING()
Definition: stats_data.h:284
grpc_endpoint
Definition: endpoint.h:105
GRPC_HTTP2_NO_ERROR
@ GRPC_HTTP2_NO_ERROR
Definition: http2_errors.h:24
grpc_slice_buffer_reset_and_unref_internal
void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:238
STREAM_LIST_COUNT
@ STREAM_LIST_COUNT
Definition: src/core/ext/transport/chttp2/transport/internal.h:86
grpc_chttp2_stream::eos_sent
bool eos_sent
Definition: src/core/ext/transport/chttp2/transport/internal.h:526
GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA
#define GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA()
Definition: stats_data.h:224
grpc_chttp2_transport::read_buffer
grpc_slice_buffer read_buffer
Definition: src/core/ext/transport/chttp2/transport/internal.h:281
DEFAULT_MAX_PING_STRIKES
#define DEFAULT_MAX_PING_STRIKES
Definition: chttp2_transport.cc:116
bitset.h
grpc_chttp2_transport_start_reading
void grpc_chttp2_transport_start_reading(grpc_transport *transport, grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings, grpc_closure *notify_on_close)
Definition: chttp2_transport.cc:3128
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
cancel_unstarted_streams
static void cancel_unstarted_streams(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: chttp2_transport.cc:1087
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
grpc_stream_refcount
Definition: transport.h:178
grpc_core::ReclamationPass::kDestructive
@ kDestructive
grpc_core::Duration::Infinity
static constexpr Duration Infinity()
Definition: src/core/lib/gprpp/time.h:139
grpc_core::RefCounted::Ref
RefCountedPtr< Child > Ref() GRPC_MUST_USE_RESULT
Definition: ref_counted.h:287
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
GRPC_ERROR_INT_GRPC_STATUS
@ GRPC_ERROR_INT_GRPC_STATUS
grpc status code representing this error
Definition: error.h:66
GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN
#define GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN()
Definition: stats_data.h:308
DEFAULT_SERVER_KEEPALIVE_TIME_MS
#define DEFAULT_SERVER_KEEPALIVE_TIME_MS
Definition: chttp2_transport.cc:109
error_utils.h
GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA
#define GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA()
Definition: stats_data.h:254
grpc_transport_stream_op_batch_payload::cancel_stream
struct grpc_transport_stream_op_batch_payload::@46 cancel_stream
id
uint32_t id
Definition: flow_control_fuzzer.cc:70
DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS
#define DEFAULT_SERVER_KEEPALIVE_TIMEOUT_MS
Definition: chttp2_transport.cc:110
grpc_chttp2_setting_parameters::min_value
uint32_t min_value
Definition: http2_settings.h:52
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
chttp2_get_endpoint
static grpc_endpoint * chttp2_get_endpoint(grpc_transport *t)
Definition: chttp2_transport.cc:3097
parse_error
@ parse_error
Definition: pem_info.c:88
grpc_core::chttp2::TransportFlowControl::bdp_probe
bool bdp_probe() const
Definition: flow_control.h:151
api.h
GRPC_ARG_MAX_CONCURRENT_STREAMS
#define GRPC_ARG_MAX_CONCURRENT_STREAMS
Definition: grpc_types.h:150
port_platform.h
grpc_chttp2_transport::combiner
grpc_core::Combiner * combiner
Definition: src/core/ext/transport/chttp2/transport/internal.h:252
begin_writing_desc
static const char * begin_writing_desc(bool partial)
Definition: chttp2_transport.cc:939
g_default_min_recv_ping_interval_without_data_ms
static int g_default_min_recv_ping_interval_without_data_ms
Definition: chttp2_transport.cc:133
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:54