writing.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <inttypes.h>
22 #include <stddef.h>
23 
24 #include <algorithm>
25 #include <string>
26 
27 #include "absl/types/optional.h"
28 
29 #include <grpc/slice.h>
30 #include <grpc/slice_buffer.h>
31 #include <grpc/support/log.h>
32 
33 // IWYU pragma: no_include "src/core/lib/gprpp/orphanable.h"
34 
67 
70  cb->next = *list;
71  *list = cb;
72 }
73 
77  "finish_write_cb");
78  cb->next = t->write_cb_pool;
79  t->write_cb_pool = cb;
80 }
81 
83  grpc_chttp2_ping_queue* pq = &t->ping_queue;
85  /* no ping needed: wait */
86  return;
87  }
89  /* ping already in-flight: wait */
93  gpr_log(GPR_INFO, "%s: Ping delayed [%s]: already pinging",
94  t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str());
95  }
96  return;
97  }
98  if (t->is_client && t->ping_state.pings_before_data_required == 0 &&
99  t->ping_policy.max_pings_without_data != 0) {
100  /* need to receive something of substance before sending a ping again */
105  "CLIENT: Ping delayed [%s]: too many recent pings: %d/%d",
106  t->peer_string.c_str(), t->ping_state.pings_before_data_required,
107  t->ping_policy.max_pings_without_data);
108  }
109  return;
110  }
111  // InvalidateNow to avoid getting stuck re-initializing the ping timer
112  // in a loop while draining the currently-held combiner. Also see
113  // https://github.com/grpc/grpc/issues/26079.
116 
117  grpc_core::Duration next_allowed_ping_interval = grpc_core::Duration::Zero();
118  if (t->is_client) {
119  next_allowed_ping_interval =
120  (t->keepalive_permit_without_calls == 0 &&
121  grpc_chttp2_stream_map_size(&t->stream_map) == 0)
123  : grpc_core::Duration::Seconds(1); /* A second is added to deal with
124  network delays and timing imprecision */
125  } else if (t->sent_goaway_state != GRPC_CHTTP2_GRACEFUL_GOAWAY) {
126  // The gRPC keepalive spec doesn't call for any throttling on the server
127  // side, but we are adding some throttling for protection anyway, unless
128  // we are doing a graceful GOAWAY in which case we don't want to wait.
129  next_allowed_ping_interval =
130  t->keepalive_time == grpc_core::Duration::Infinity()
132  : t->keepalive_time / 2;
133  }
134  grpc_core::Timestamp next_allowed_ping =
135  t->ping_state.last_ping_sent_time + next_allowed_ping_interval;
136 
137  if (next_allowed_ping > now) {
138  /* not enough elapsed time between successive pings */
142  gpr_log(
143  GPR_INFO,
144  "%s: Ping delayed [%s]: not enough time elapsed since last "
145  "ping. "
146  " Last ping %" PRId64 ": Next ping %" PRId64 ": Now %" PRId64,
147  t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
148  t->ping_state.last_ping_sent_time.milliseconds_after_process_epoch(),
149  next_allowed_ping.milliseconds_after_process_epoch(),
150  now.milliseconds_after_process_epoch());
151  }
152  if (!t->ping_state.is_delayed_ping_timer_set) {
153  t->ping_state.is_delayed_ping_timer_set = true;
154  GRPC_CHTTP2_REF_TRANSPORT(t, "retry_initiate_ping_locked");
155  GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked,
157  grpc_schedule_on_exec_ctx);
158  grpc_timer_init(&t->ping_state.delayed_ping_timer, next_allowed_ping,
159  &t->retry_initiate_ping_locked);
160  }
161  return;
162  }
163  t->ping_state.last_ping_sent_time = now;
164 
165  pq->inflight_id = t->ping_ctr;
166  t->ping_ctr++;
171  grpc_slice_buffer_add(&t->outbuf,
177  gpr_log(GPR_INFO, "%s: Ping sent [%s]: %d/%d",
178  t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
179  t->ping_state.pings_before_data_required,
180  t->ping_policy.max_pings_without_data);
181  }
182  t->ping_state.pings_before_data_required -=
183  (t->ping_state.pings_before_data_required != 0);
184 }
185 
187  int64_t send_bytes, grpc_chttp2_write_cb** list,
189  bool sched_any = false;
190  grpc_chttp2_write_cb* cb = *list;
191  *list = nullptr;
192  *ctr += send_bytes;
193  while (cb) {
194  grpc_chttp2_write_cb* next = cb->next;
195  if (cb->call_at_byte <= *ctr) {
196  sched_any = true;
198  } else {
199  add_to_write_list(list, cb);
200  }
201  cb = next;
202  }
204  return sched_any;
205 }
206 
208  const char* staller) {
210  gpr_log(
211  GPR_DEBUG,
212  "%s:%p stream %d moved to stalled list by %s. This is FULLY expected "
213  "to happen in a healthy program that is not seeing flow control stalls."
214  " However, if you know that there are unwanted stalls, here is some "
215  "helpful data: [fc:pending=%" PRIdPTR ":flowed=%" PRId64
216  ":peer_initwin=%d:t_win=%" PRId64 ":s_win=%d:s_delta=%" PRId64 "]",
217  t->peer_string.c_str(), t, s->id, staller,
218  s->flow_controlled_buffer.length, s->flow_controlled_bytes_flowed,
219  t->settings[GRPC_ACKED_SETTINGS]
221  t->flow_control.remote_window(),
222  static_cast<uint32_t>(std::max(
223  int64_t(0),
224  s->flow_control.remote_window_delta() +
225  static_cast<int64_t>(
226  t->settings[GRPC_PEER_SETTINGS]
228  s->flow_control.remote_window_delta());
229  }
230 }
231 
232 /* How many bytes would we like to put on the wire during a single syscall */
234  return 1024 * 1024;
235 }
236 
237 namespace {
238 
239 class CountDefaultMetadataEncoder {
240  public:
241  size_t count() const { return count_; }
242 
243  void Encode(const grpc_core::Slice&, const grpc_core::Slice&) {}
244 
245  template <typename Which>
246  void Encode(Which, const typename Which::ValueType&) {
247  count_++;
248  }
249 
250  private:
251  size_t count_ = 0;
252 };
253 
254 } // namespace
255 
256 // Returns true if initial_metadata contains only default headers.
257 static bool is_default_initial_metadata(grpc_metadata_batch* initial_metadata) {
258  CountDefaultMetadataEncoder enc;
259  initial_metadata->Encode(&enc);
260  return enc.count() == initial_metadata->count();
261 }
262 
263 namespace {
264 
265 class WriteContext {
266  public:
267  explicit WriteContext(grpc_chttp2_transport* t) : t_(t) {
269  GPR_TIMER_SCOPE("grpc_chttp2_begin_write", 0);
270  }
271 
272  // TODO(ctiller): make this the destructor
273  void FlushStats() {
275  initial_metadata_writes_);
278  trailing_metadata_writes_);
279  GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(flow_control_writes_);
280  }
281 
282  void FlushSettings() {
283  if (t_->dirtied_local_settings && !t_->sent_local_settings) {
285  &t_->outbuf, grpc_chttp2_settings_create(
286  t_->settings[GRPC_SENT_SETTINGS],
287  t_->settings[GRPC_LOCAL_SETTINGS],
288  t_->force_send_settings, GRPC_CHTTP2_NUM_SETTINGS));
289  t_->force_send_settings = false;
290  t_->dirtied_local_settings = false;
291  t_->sent_local_settings = true;
293  }
294  }
295 
296  void FlushQueuedBuffers() {
297  /* simple writes are queued to qbuf, and flushed here */
298  grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf);
299  t_->num_pending_induced_frames = 0;
300  GPR_ASSERT(t_->qbuf.count == 0);
301  }
302 
303  void FlushWindowUpdates() {
304  uint32_t transport_announce =
305  t_->flow_control.MaybeSendUpdate(t_->outbuf.count > 0);
306  if (transport_announce) {
307  grpc_transport_one_way_stats throwaway_stats;
309  &t_->outbuf, grpc_chttp2_window_update_create(0, transport_announce,
310  &throwaway_stats));
312  }
313  }
314 
315  void FlushPingAcks() {
316  for (size_t i = 0; i < t_->ping_ack_count; i++) {
317  grpc_slice_buffer_add(&t_->outbuf,
318  grpc_chttp2_ping_create(true, t_->ping_acks[i]));
319  }
320  t_->ping_ack_count = 0;
321  }
322 
323  void EnactHpackSettings() {
324  t_->hpack_compressor.SetMaxTableSize(
325  t_->settings[GRPC_PEER_SETTINGS]
327  }
328 
329  void UpdateStreamsNoLongerStalled() {
332  if (GRPC_ERROR_IS_NONE(t_->closed_with_error) &&
334  if (!s->refcount->refs.RefIfNonZero()) {
336  }
337  }
338  }
339  }
340 
341  grpc_chttp2_stream* NextStream() {
342  if (t_->outbuf.length > target_write_size(t_)) {
343  result_.partial = true;
344  return nullptr;
345  }
346 
349  return nullptr;
350  }
351 
352  return s;
353  }
354 
355  void IncInitialMetadataWrites() { ++initial_metadata_writes_; }
356  void IncWindowUpdateWrites() { ++flow_control_writes_; }
357  void IncMessageWrites() { ++message_writes_; }
358  void IncTrailingMetadataWrites() { ++trailing_metadata_writes_; }
359 
360  void NoteScheduledResults() { result_.early_results_scheduled = true; }
361 
362  grpc_chttp2_transport* transport() const { return t_; }
363 
365  result_.writing = t_->outbuf.count > 0;
366  return result_;
367  }
368 
369  private:
370  grpc_chttp2_transport* const t_;
371 
372  /* stats histogram counters: we increment these throughout this function,
373  and at the end publish to the central stats histograms */
374  int flow_control_writes_ = 0;
375  int initial_metadata_writes_ = 0;
376  int trailing_metadata_writes_ = 0;
377  int message_writes_ = 0;
378  grpc_chttp2_begin_write_result result_ = {false, false, false};
379 };
380 
381 class DataSendContext {
382  public:
383  DataSendContext(WriteContext* write_context, grpc_chttp2_transport* t,
385  : write_context_(write_context),
386  t_(t),
387  s_(s),
388  sending_bytes_before_(s_->sending_bytes) {}
389 
390  uint32_t stream_remote_window() const {
391  return static_cast<uint32_t>(std::max(
392  int64_t(0),
393  s_->flow_control.remote_window_delta() +
394  static_cast<int64_t>(
395  t_->settings[GRPC_PEER_SETTINGS]
397  }
398 
399  uint32_t max_outgoing() const {
400  return static_cast<uint32_t>(std::min(
402  static_cast<uint32_t>(std::min(int64_t(stream_remote_window()),
403  t_->flow_control.remote_window()))));
404  }
405 
406  bool AnyOutgoing() const { return max_outgoing() > 0; }
407 
408  void FlushBytes() {
409  uint32_t send_bytes = static_cast<uint32_t>(
410  std::min(size_t(max_outgoing()), s_->flow_controlled_buffer.length));
411  is_last_frame_ = send_bytes == s_->flow_controlled_buffer.length &&
412  s_->send_trailing_metadata != nullptr &&
413  s_->send_trailing_metadata->empty();
414  grpc_chttp2_encode_data(s_->id, &s_->flow_controlled_buffer, send_bytes,
415  is_last_frame_, &s_->stats.outgoing, &t_->outbuf);
416  sfc_upd_.SentData(send_bytes);
417  s_->sending_bytes += send_bytes;
418  }
419 
420  bool is_last_frame() const { return is_last_frame_; }
421 
422  void CallCallbacks() {
423  if (update_list(
424  t_, s_,
425  static_cast<int64_t>(s_->sending_bytes - sending_bytes_before_),
426  &s_->on_flow_controlled_cbs, &s_->flow_controlled_bytes_flowed,
427  GRPC_ERROR_NONE)) {
428  write_context_->NoteScheduledResults();
429  }
430  }
431 
432  private:
433  WriteContext* write_context_;
437  &s_->flow_control};
438  const size_t sending_bytes_before_;
439  bool is_last_frame_ = false;
440 };
441 
442 class StreamWriteContext {
443  public:
444  StreamWriteContext(WriteContext* write_context, grpc_chttp2_stream* s)
445  : write_context_(write_context), t_(write_context->transport()), s_(s) {
447  gpr_log(GPR_INFO, "W:%p %s[%d] im-(sent,send)=(%d,%d)", t_,
448  t_->is_client ? "CLIENT" : "SERVER", s->id,
449  s->sent_initial_metadata, s->send_initial_metadata != nullptr));
450  }
451 
452  void FlushInitialMetadata() {
453  /* send initial metadata if it's available */
454  if (s_->sent_initial_metadata) return;
455  if (s_->send_initial_metadata == nullptr) return;
456 
457  // We skip this on the server side if there is no custom initial
458  // metadata, there are no messages to send, and we are also sending
459  // trailing metadata. This results in a Trailers-Only response,
460  // which is required for retries, as per:
461  // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#when-retries-are-valid
462  if (!t_->is_client && s_->flow_controlled_buffer.length == 0 &&
463  s_->send_trailing_metadata != nullptr &&
464  is_default_initial_metadata(s_->send_initial_metadata)) {
465  ConvertInitialMetadataToTrailingMetadata();
466  } else {
467  t_->hpack_compressor.EncodeHeaders(
469  s_->id, // stream_id
470  false, // is_eof
471  t_->settings
474  0, // use_true_binary_metadata
475  t_->settings
477  [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size
478  &s_->stats.outgoing // stats
479  },
480  *s_->send_initial_metadata, &t_->outbuf);
482  write_context_->IncInitialMetadataWrites();
483  }
484 
485  s_->send_initial_metadata = nullptr;
486  s_->sent_initial_metadata = true;
487  write_context_->NoteScheduledResults();
489  t_, s_, &s_->send_initial_metadata_finished, GRPC_ERROR_NONE,
490  "send_initial_metadata_finished");
491  }
492 
493  void FlushWindowUpdates() {
494  if (s_->read_closed) return;
495 
496  /* send any window updates */
497  const uint32_t stream_announce = s_->flow_control.MaybeSendUpdate();
498  if (stream_announce == 0) return;
499 
501  &t_->outbuf, grpc_chttp2_window_update_create(s_->id, stream_announce,
502  &s_->stats.outgoing));
504  write_context_->IncWindowUpdateWrites();
505  }
506 
507  void FlushData() {
508  if (!s_->sent_initial_metadata) return;
509 
510  if (s_->flow_controlled_buffer.length == 0) {
511  return; // early out: nothing to do
512  }
513 
514  DataSendContext data_send_context(write_context_, t_, s_);
515 
516  if (!data_send_context.AnyOutgoing()) {
517  if (t_->flow_control.remote_window() <= 0) {
518  report_stall(t_, s_, "transport");
520  } else if (data_send_context.stream_remote_window() <= 0) {
521  report_stall(t_, s_, "stream");
523  }
524  return; // early out: nothing to do
525  }
526 
527  while (s_->flow_controlled_buffer.length > 0 &&
528  data_send_context.max_outgoing() > 0) {
529  data_send_context.FlushBytes();
530  }
532  if (data_send_context.is_last_frame()) {
533  SentLastFrame();
534  }
535  data_send_context.CallCallbacks();
536  stream_became_writable_ = true;
537  if (s_->flow_controlled_buffer.length > 0) {
538  GRPC_CHTTP2_STREAM_REF(s_, "chttp2_writing:fork");
540  }
541  write_context_->IncMessageWrites();
542  }
543 
544  void FlushTrailingMetadata() {
545  if (!s_->sent_initial_metadata) return;
546 
547  if (s_->send_trailing_metadata == nullptr) return;
548  if (s_->flow_controlled_buffer.length != 0) return;
549 
550  GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "sending trailing_metadata"));
551  if (s_->send_trailing_metadata->empty()) {
552  grpc_chttp2_encode_data(s_->id, &s_->flow_controlled_buffer, 0, true,
553  &s_->stats.outgoing, &t_->outbuf);
554  } else {
555  if (send_status_.has_value()) {
556  s_->send_trailing_metadata->Set(grpc_core::HttpStatusMetadata(),
557  *send_status_);
558  }
559  if (send_content_type_.has_value()) {
560  s_->send_trailing_metadata->Set(grpc_core::ContentTypeMetadata(),
561  *send_content_type_);
562  }
563  t_->hpack_compressor.EncodeHeaders(
565  s_->id, true,
566  t_->settings
569  0,
570  t_->settings[GRPC_PEER_SETTINGS]
572  &s_->stats.outgoing},
573  *s_->send_trailing_metadata, &t_->outbuf);
574  }
575  write_context_->IncTrailingMetadataWrites();
577  SentLastFrame();
578 
579  write_context_->NoteScheduledResults();
581  t_, s_, &s_->send_trailing_metadata_finished, GRPC_ERROR_NONE,
582  "send_trailing_metadata_finished");
583  }
584 
585  bool stream_became_writable() { return stream_became_writable_; }
586 
587  private:
588  void ConvertInitialMetadataToTrailingMetadata() {
590  gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)"));
591  // When sending Trailers-Only, we need to move the :status and
592  // content-type headers to the trailers.
593  send_status_ =
594  s_->send_initial_metadata->get(grpc_core::HttpStatusMetadata());
595  send_content_type_ =
596  s_->send_initial_metadata->get(grpc_core::ContentTypeMetadata());
597  }
598 
599  void SentLastFrame() {
600  s_->send_trailing_metadata = nullptr;
601  if (s_->sent_trailing_metadata_op) {
602  *s_->sent_trailing_metadata_op = true;
603  s_->sent_trailing_metadata_op = nullptr;
604  }
605  s_->sent_trailing_metadata = true;
606  s_->eos_sent = true;
607 
608  if (!t_->is_client && !s_->read_closed) {
610  &t_->outbuf, grpc_chttp2_rst_stream_create(
611  s_->id, GRPC_HTTP2_NO_ERROR, &s_->stats.outgoing));
612  }
613  grpc_chttp2_mark_stream_closed(t_, s_, !t_->is_client, true,
615  }
616 
617  WriteContext* const write_context_;
618  grpc_chttp2_transport* const t_;
619  grpc_chttp2_stream* const s_;
620  bool stream_became_writable_ = false;
621  absl::optional<uint32_t> send_status_;
623  {};
624 };
625 } // namespace
626 
629  WriteContext ctx(t);
630  ctx.FlushSettings();
631  ctx.FlushPingAcks();
632  ctx.FlushQueuedBuffers();
633  ctx.EnactHpackSettings();
634 
635  if (t->flow_control.remote_window() > 0) {
636  ctx.UpdateStreamsNoLongerStalled();
637  }
638 
639  /* for each grpc_chttp2_stream that's become writable, frame it's data
640  (according to available window sizes) and add to the output buffer */
641  while (grpc_chttp2_stream* s = ctx.NextStream()) {
642  StreamWriteContext stream_ctx(&ctx, s);
643  size_t orig_len = t->outbuf.length;
644  stream_ctx.FlushInitialMetadata();
645  stream_ctx.FlushWindowUpdates();
646  stream_ctx.FlushData();
647  stream_ctx.FlushTrailingMetadata();
648  if (t->outbuf.length > orig_len) {
649  /* Add this stream to the list of the contexts to be traced at TCP */
650  s->byte_counter += t->outbuf.length - orig_len;
651  if (s->traced && grpc_endpoint_can_track_err(t->ep)) {
653  }
654  }
655  if (stream_ctx.stream_became_writable()) {
657  /* already in writing list: drop ref */
658  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:already_writing");
659  } else {
660  /* ref will be dropped at end of write */
661  }
662  } else {
663  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:no_write");
664  }
665  }
666 
667  ctx.FlushWindowUpdates();
668 
670 
671  return ctx.Result();
672 }
673 
675  GPR_TIMER_SCOPE("grpc_chttp2_end_write", 0);
677 
678  if (t->channelz_socket != nullptr) {
679  t->channelz_socket->RecordMessagesSent(t->num_messages_in_next_write);
680  }
681  t->num_messages_in_next_write = 0;
682 
683  while (grpc_chttp2_list_pop_writing_stream(t, &s)) {
684  if (s->sending_bytes != 0) {
685  update_list(t, s, static_cast<int64_t>(s->sending_bytes),
686  &s->on_write_finished_cbs, &s->flow_controlled_bytes_written,
688  s->sending_bytes = 0;
689  }
690  GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:end");
691  }
694 }
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
trace.h
grpc_keepalive_trace
grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive")
grpc_core::Duration::Hours
static constexpr Duration Hours(int64_t hours)
Definition: src/core/lib/gprpp/time.h:143
slice.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
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
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
now
static double now(void)
Definition: test/core/fling/client.cc:130
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
metadata_batch.h
GRPC_SENT_SETTINGS
@ GRPC_SENT_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:212
ctx
Definition: benchmark-async.c:30
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_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
maybe_initiate_ping
static void maybe_initiate_ping(grpc_chttp2_transport *t)
Definition: writing.cc:82
grpc_flowctl_trace
grpc_core::TraceFlag grpc_flowctl_trace(false, "flowctl")
grpc_core::ExecCtx::RunList
static void RunList(const DebugLocation &location, grpc_closure_list *list)
Definition: exec_ctx.cc:129
timers.h
target_write_size
static uint32_t target_write_size(grpc_chttp2_transport *)
Definition: writing.cc:233
slice.h
internal.h
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_core::Slice
Definition: src/core/lib/slice/slice.h:282
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_STATS_INC_HTTP2_SETTINGS_WRITES
#define GRPC_STATS_INC_HTTP2_SETTINGS_WRITES()
Definition: stats_data.h:230
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_core::ContextList::Append
static void Append(ContextList **head, grpc_chttp2_stream *s)
Definition: context_list.cc:34
closure.h
grpc_http_trace
grpc_core::TraceFlag grpc_http_trace(false, "http")
GRPC_CHTTP2_PCL_INITIATE
@ GRPC_CHTTP2_PCL_INITIATE
Definition: src/core/ext/transport/chttp2/transport/internal.h:101
frame_settings.h
ctx
static struct test_ctx ctx
Definition: test-ipc-send-recv.c:65
frame_data.h
GRPC_CHTTP2_STREAM_UNREF
#define GRPC_CHTTP2_STREAM_UNREF(stream, reason)
Definition: src/core/ext/transport/chttp2/transport/internal.h:700
absl::FormatConversionChar::s
@ s
grpc_chttp2_begin_write
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(grpc_chttp2_transport *t)
Definition: writing.cc:627
grpc_core::HttpStatusMetadata
Definition: metadata_batch.h:320
update_list
static bool update_list(grpc_chttp2_transport *t, grpc_chttp2_stream *s, int64_t send_bytes, grpc_chttp2_write_cb **list, int64_t *ctr, grpc_error_handle error)
Definition: writing.cc:186
GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
@ GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE
Definition: http2_settings.h:29
channelz.h
GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA
@ GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA
Definition: http2_settings.h:35
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
GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE
#define GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(value)
Definition: stats_data.h:426
stats.h
grpc_chttp2_stream
Definition: src/core/ext/transport/chttp2/transport/internal.h:456
grpc_core::HPackCompressor::EncodeHeaderOptions
Definition: hpack_encoder.h:68
grpc_core::MetadataMap::count
size_t count() const
Definition: metadata_batch.h:1167
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
http2_settings.h
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
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
re2::Result
TestInstance::Result Result
Definition: bloaty/third_party/re2/re2/testing/tester.cc:96
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE
#define GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(value)
Definition: stats_data.h:420
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE
#define GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE(value)
Definition: stats_data.h:417
GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
@ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE
Definition: http2_settings.h:33
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
transport
grpc_transport transport
Definition: filter_fuzzer.cc:146
grpc_chttp2_list_add_stalled_by_stream
void grpc_chttp2_list_add_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:203
grpc_chttp2_list_pop_stalled_by_transport
bool grpc_chttp2_list_pop_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:193
grpc_core::Timestamp::milliseconds_after_process_epoch
uint64_t milliseconds_after_process_epoch() const
Definition: src/core/lib/gprpp/time.h:109
absl::optional< uint32_t >
slice_buffer.h
GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE
#define GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE(value)
Definition: stats_data.h:423
is_default_initial_metadata
static bool is_default_initial_metadata(grpc_metadata_batch *initial_metadata)
Definition: writing.cc:257
time.h
grpc_chttp2_window_update_create
grpc_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats *stats)
Definition: frame_window_update.cc:33
frame_ping.h
error.h
grpc_chttp2_ping_create
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes)
Definition: frame_ping.cc:39
slice_internal.h
min
#define min(a, b)
Definition: qsort.h:83
grpc_chttp2_settings_create
grpc_slice grpc_chttp2_settings_create(uint32_t *old_settings, const uint32_t *new_settings, uint32_t force_mask, size_t count)
Definition: frame_settings.cc:56
GRPC_CHTTP2_PCL_NEXT
@ GRPC_CHTTP2_PCL_NEXT
Definition: src/core/ext/transport/chttp2/transport/internal.h:102
grpc_transport_one_way_stats
Definition: transport.h:243
GRPC_PEER_SETTINGS
@ GRPC_PEER_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:208
Json::ValueType
ValueType
Type of the value held by a Value object.
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:463
grpc_chttp2_begin_write_result
Definition: src/core/ext/transport/chttp2/transport/internal.h:584
GRPC_LOCAL_SETTINGS
@ GRPC_LOCAL_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:210
stream_map.h
bdp_estimator.h
grpc_chttp2_stream_map_size
size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map *map)
Definition: stream_map.cc:150
grpc_chttp2_list_add_writing_stream
bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:159
frame.h
grpc_core::Duration::Zero
static constexpr Duration Zero()
Definition: src/core/lib/gprpp/time.h:130
GRPC_ACKED_SETTINGS
@ GRPC_ACKED_SETTINGS
Definition: src/core/ext/transport/chttp2/transport/internal.h:214
GRPC_CHTTP2_REF_TRANSPORT
#define GRPC_CHTTP2_REF_TRANSPORT(t, r)
Definition: src/core/ext/transport/chttp2/transport/internal.h:713
count_
int * count_
Definition: connectivity_state_test.cc:65
grpc_slice_buffer_add
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
Definition: slice/slice_buffer.cc:170
add_to_write_list
static void add_to_write_list(grpc_chttp2_write_cb **list, grpc_chttp2_write_cb *cb)
Definition: writing.cc:68
grpc_chttp2_rst_stream_create
grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, grpc_transport_one_way_stats *stats)
Definition: frame_rst_stream.cc:38
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
debug_location.h
GRPC_CHTTP2_STREAM_REF
#define GRPC_CHTTP2_STREAM_REF(stream, reason)
Definition: src/core/ext/transport/chttp2/transport/internal.h:698
GRPC_CHTTP2_NUM_SETTINGS
#define GRPC_CHTTP2_NUM_SETTINGS
Definition: http2_settings.h:38
ref_counted.h
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
GRPC_CHTTP2_IF_TRACING
#define GRPC_CHTTP2_IF_TRACING(stmt)
Definition: src/core/ext/transport/chttp2/transport/internal.h:682
report_stall
static void report_stall(grpc_chttp2_transport *t, grpc_chttp2_stream *s, const char *staller)
Definition: writing.cc:207
absl::str_format_internal::LengthMod::t
@ t
grpc_chttp2_retry_initiate_ping
void grpc_chttp2_retry_initiate_ping(void *tp, grpc_error_handle error)
Definition: chttp2_transport.cc:1688
frame_window_update.h
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
grpc_endpoint_can_track_err
bool grpc_endpoint_can_track_err(grpc_endpoint *ep)
Definition: endpoint.cc:65
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_chttp2_ping_queue::inflight_id
uint64_t inflight_id
Definition: src/core/ext/transport/chttp2/transport/internal.h:137
http2_errors.h
grpc_chttp2_transport
Definition: src/core/ext/transport/chttp2/transport/internal.h:238
hpack_encoder.h
finish_write_cb
static void finish_write_cb(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_chttp2_write_cb *cb, grpc_error_handle error)
Definition: writing.cc:74
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
@ GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
Definition: http2_settings.h:32
exec_ctx.h
grpc_timer_init
void grpc_timer_init(grpc_timer *timer, grpc_core::Timestamp deadline, grpc_closure *closure)
Definition: iomgr/timer.cc:31
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_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
ref_counted_ptr.h
transport.h
GRPC_STATS_INC_HTTP2_PINGS_SENT
#define GRPC_STATS_INC_HTTP2_PINGS_SENT()
Definition: stats_data.h:232
timer.h
context_list.h
grpc_chttp2_write_cb
Definition: src/core/ext/transport/chttp2/transport/internal.h:225
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
grpc_chttp2_encode_data
void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, grpc_transport_one_way_stats *stats, grpc_slice_buffer *outbuf)
Definition: frame_data.cc:54
grpc_core::chttp2::StreamFlowControl::OutgoingUpdateContext
Definition: flow_control.h:329
grpc_core::ContentTypeMetadata
Definition: metadata_batch.h:92
grpc_chttp2_reset_ping_clock
void grpc_chttp2_reset_ping_clock(grpc_chttp2_transport *t)
Definition: chttp2_transport.cc:1861
grpc_core::ExecCtx::Now
Timestamp Now()
Definition: exec_ctx.cc:90
endpoint.h
grpc_bdp_estimator_trace
grpc_core::TraceFlag grpc_bdp_estimator_trace(false, "bdp_estimator")
grpc_closure_list_move
void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst)
Definition: closure.h:228
GRPC_STATS_INC_HTTP2_WRITES_BEGUN
#define GRPC_STATS_INC_HTTP2_WRITES_BEGUN()
Definition: stats_data.h:234
grpc_error
Definition: error_internal.h:42
grpc_chttp2_end_write
void grpc_chttp2_end_write(grpc_chttp2_transport *t, grpc_error_handle error)
Definition: writing.cc:674
grpc_core::Duration
Definition: src/core/lib/gprpp/time.h:122
grpc_chttp2_list_pop_writing_stream
bool grpc_chttp2_list_pop_writing_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:168
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_core::MetadataMap::Encode
void Encode(Encoder *encoder) const
Definition: metadata_batch.h:1011
frame_rst_stream.h
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
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
grpc_core::Duration::Infinity
static constexpr Duration Infinity()
Definition: src/core/lib/gprpp/time.h:139
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
s_
std::string s_
Definition: abseil-cpp/absl/container/btree_test.cc:1031
grpc_core::ExecCtx::InvalidateNow
void InvalidateNow()
Definition: exec_ctx.h:188
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
grpc_chttp2_list_add_stalled_by_transport
void grpc_chttp2_list_add_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:188
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:53