GRPC Core  9.0.0
internal.h
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 
19 #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
20 #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H
21 
23 
24 #include <assert.h>
25 #include <stdbool.h>
26 
47 
48 namespace grpc_core {
49 class ContextList;
50 }
51 
52 /* streams are kept in various linked lists depending on what things need to
53  happen to them... this enum labels each list */
54 typedef enum {
62  STREAM_LIST_COUNT /* must be last */
64 
65 typedef enum {
70 
71 typedef enum {
75 
76 typedef enum {
80  GRPC_CHTTP2_PCL_COUNT /* must be last */
82 
83 typedef enum {
105 
108 
109 typedef struct {
111  uint64_t inflight_id = 0;
113 
114 typedef struct {
120 
121 typedef struct {
127 
128 typedef struct {
132 
133 /* deframer state for the overall http2 stream of bytes */
134 typedef enum {
135  /* prefix: one entry per http2 connection prefix byte */
160  /* frame header byte 0... */
161  /* must follow from the prefix states */
170  /* ... frame header byte 8 */
172  /* inside a http2 frame */
175 
176 typedef struct {
180 
181 typedef struct {
185 
186 /* We keep several sets of connection wide parameters */
187 typedef enum {
188  /* The settings our peer has asked for (and we have acked) */
190  /* The settings we'd like to have */
192  /* The settings we've published to our peer */
194  /* The settings the peer has acked */
198 
199 typedef enum {
204 
205 typedef struct grpc_chttp2_write_cb {
206  int64_t call_at_byte;
210 
211 namespace grpc_core {
212 
214  public:
216  grpc_chttp2_stream* stream, uint32_t frame_size,
217  uint32_t flags);
218 
219  void Orphan() override;
220 
221  bool Next(size_t max_size_hint, grpc_closure* on_complete) override;
222  grpc_error* Pull(grpc_slice* slice) override;
223  void Shutdown(grpc_error* error) override;
224 
225  // TODO(roth): When I converted this class to C++, I wanted to make it
226  // inherit from RefCounted or InternallyRefCounted instead of continuing
227  // to use its own custom ref-counting code. However, that would require
228  // using multiple inheritance, which sucks in general. And to make matters
229  // worse, it causes problems with our New<> and Delete<> wrappers.
230  // Specifically, unless RefCounted is first in the list of parent classes,
231  // it will see a different value of the address of the object than the one
232  // we actually allocated, in which case gpr_free() will be called on a
233  // different address than the one we got from gpr_malloc(), thus causing a
234  // crash. Given the fragility of depending on that, as well as a desire to
235  // avoid multiple inheritance in general, I've decided to leave this
236  // alone for now. We can revisit this once we're able to link against
237  // libc++, at which point we can eliminate New<> and Delete<> and
238  // switch to std::shared_ptr<>.
239  void Ref() { refs_.Ref(); }
240  void Unref() {
241  if (GPR_UNLIKELY(refs_.Unref())) {
242  delete this;
243  }
244  }
245 
246  void PublishError(grpc_error* error);
247 
248  grpc_error* Push(const grpc_slice& slice, grpc_slice* slice_out);
249 
250  grpc_error* Finished(grpc_error* error, bool reset_on_error);
251 
252  uint32_t remaining_bytes() const { return remaining_bytes_; }
253 
254  private:
255  static void NextLocked(void* arg, grpc_error* error_ignored);
256  static void OrphanLocked(void* arg, grpc_error* error_ignored);
257 
258  void MaybeCreateStreamDecompressionCtx();
259 
260  grpc_chttp2_transport* transport_; // Immutable.
261  grpc_chttp2_stream* stream_; // Immutable.
262 
263  grpc_core::RefCount refs_;
264 
265  /* Accessed only by transport thread when stream->pending_byte_stream == false
266  * Accessed only by application thread when stream->pending_byte_stream ==
267  * true */
268  uint32_t remaining_bytes_;
269 
270  /* Accessed only by transport thread when stream->pending_byte_stream == false
271  * Accessed only by application thread when stream->pending_byte_stream ==
272  * true */
273  struct {
277  } next_action_;
278  grpc_closure destroy_action_;
279 };
280 
281 } // namespace grpc_core
282 
283 typedef enum {
289 
291  grpc_chttp2_transport(const grpc_channel_args* channel_args,
292  grpc_endpoint* ep, bool is_client,
295 
296  grpc_transport base; /* must be first */
299  char* peer_string;
300 
302 
304 
306 
309 
311  uint8_t destroying = false;
314 
316  uint8_t endpoint_reading = 1;
317 
320 
323 
327 
329 
332 
337 
338  /* accept stream callback */
339  void (*accept_stream_cb)(void* user_data, grpc_transport* transport,
340  const void* server_data);
342 
345 
351  bool is_client;
352 
355 
358  uint32_t write_buffer_size = grpc_core::chttp2::kDefaultWindow;
359 
363 
365 
369  bool sent_local_settings = false;
376 
379  uint32_t next_stream_id = 0;
380 
382  uint32_t last_new_stream_id = 0;
383 
388  uint64_t ping_ctr = 0; /* unique id for pings */
390 
392  size_t ping_ack_count = 0;
393  size_t ping_ack_capacity = 0;
394  uint64_t* ping_acks = nullptr;
396 
400  union {
405  } simple;
408 
418 
419  /* deframing */
421  uint8_t incoming_frame_type = 0;
422  uint8_t incoming_frame_flags = 0;
423  uint8_t header_eof = 0;
424  bool is_first_frame = true;
426  uint32_t incoming_frame_size = 0;
427  uint32_t incoming_stream_id = 0;
428 
429  /* active parser */
430  void* parser_data = nullptr;
432  grpc_error* (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
433  grpc_chttp2_stream* s, const grpc_slice& slice,
434  int is_last);
435 
437 
438  /* bdp estimator */
442 
443  /* if non-NULL, close the transport with this error when writes are finished
444  */
446 
447  /* a list of closures to run after writes are finished */
449 
450  /* buffer pool state */
459 
460  /* next bdp ping timer */
463  bool bdp_ping_started = false;
465 
466  /* keep-alive ping support */
499 };
500 
501 typedef enum {
507 
510  const void* server_data, grpc_core::Arena* arena);
512 
513  void* context;
516  // Reffer is a 0-len structure, simply reffing `t` and `refcount` in its ctor
517  // before initializing the rest of the stream, to avoid cache misses. This
518  // field MUST be right after `t` and `refcount`.
519  struct Reffer {
520  explicit Reffer(grpc_chttp2_stream* s);
521  } reffer;
522 
525 
528 
530  uint32_t id = 0;
531 
537 
546 
554 
557 
559  bool write_closed = false;
561  bool read_closed = false;
566  bool seen_error = false;
569  bool write_buffering = false;
570 
571  /* have we sent or received the EOS bit? */
572  bool eos_received = false;
573  bool eos_sent = false;
574 
579 
582 
584 
585  grpc_slice_buffer frame_storage; /* protected by t combiner */
586 
587  grpc_closure* on_next = nullptr; /* protected by t combiner */
588  bool pending_byte_stream = false; /* protected by t combiner */
589  // cached length of buffer to be used by the transport thread in cases where
590  // stream->pending_byte_stream == true. The value is saved before
591  // application threads are allowed to modify
592  // unprocessed_incoming_frames_buffer
594  /* Accessed only by transport thread when stream->pending_byte_stream == false
595  * Accessed only by application thread when stream->pending_byte_stream ==
596  * true */
599  grpc_error* byte_stream_error = GRPC_ERROR_NONE; /* protected by t combiner */
600  bool received_last_frame = false; /* protected by t combiner */
601 
603 
609  /* Accessed only by transport thread when stream->pending_byte_stream == false
610  * Accessed only by application thread when stream->pending_byte_stream ==
611  * true */
614  int64_t received_bytes = 0;
615 
616  bool sent_initial_metadata = false;
618 
624 
626 
630  size_t sending_bytes = 0;
631 
632  /* Stream compression method to be used. */
635  /* Stream decompression method to be used. */
638 
643  bool traced = false;
647  size_t byte_counter = 0;
648 
656 
664 };
665 
680 
681 typedef struct {
683  bool writing;
685  bool partial;
689 
693 
697  const grpc_slice& slice);
698 
700  grpc_chttp2_stream* s);
704  grpc_chttp2_stream** s);
706  grpc_chttp2_stream* s);
707 
709  grpc_chttp2_stream* s);
712  grpc_chttp2_stream** s);
713 
715  grpc_chttp2_stream* s);
717  grpc_chttp2_stream** s);
718 
720  grpc_chttp2_stream* s);
722  grpc_chttp2_stream** s);
724  grpc_chttp2_stream* s);
725 
727  grpc_chttp2_stream* s);
729  grpc_chttp2_stream** s);
731  grpc_chttp2_stream* s);
732 
734  grpc_chttp2_stream* s);
736  grpc_chttp2_stream** s);
738  grpc_chttp2_stream* s);
739 
740 /********* Flow Control ***************/
741 
742 // Takes in a flow control action and performs all the needed operations.
746 
747 /********* End of Flow Control ***************/
748 
750  grpc_chttp2_transport* t, uint32_t id) {
751  return static_cast<grpc_chttp2_stream*>(
753 }
755  uint32_t id);
756 
758  uint32_t goaway_error,
759  uint32_t last_stream_id,
760  const grpc_slice& goaway_text);
761 
763 
766  grpc_closure** pclosure,
767  grpc_error* error, const char* desc);
768 
769 #define GRPC_HEADER_SIZE_IN_BYTES 5
770 #define MAX_SIZE_T (~(size_t)0)
771 
772 #define GRPC_CHTTP2_CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
773 #define GRPC_CHTTP2_CLIENT_CONNECT_STRLEN \
774  (sizeof(GRPC_CHTTP2_CLIENT_CONNECT_STRING) - 1)
775 
776 // extern grpc_core::TraceFlag grpc_http_trace;
777 // extern grpc_core::TraceFlag grpc_flowctl_trace;
778 
779 #define GRPC_CHTTP2_IF_TRACING(stmt) \
780  do { \
781  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { \
782  (stmt); \
783  } \
784  } while (0)
785 
787  grpc_chttp2_stream* stream, grpc_error* error);
789  grpc_chttp2_stream* s, int close_reads,
790  int close_writes, grpc_error* error);
792 
793 #ifndef NDEBUG
794 #define GRPC_CHTTP2_STREAM_REF(stream, reason) \
795  grpc_chttp2_stream_ref(stream, reason)
796 #define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
797  grpc_chttp2_stream_unref(stream, reason)
798 void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason);
799 void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason);
800 #else
801 #define GRPC_CHTTP2_STREAM_REF(stream, reason) grpc_chttp2_stream_ref(stream)
802 #define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
803  grpc_chttp2_stream_unref(stream)
806 #endif
807 
808 #ifndef NDEBUG
809 #define GRPC_CHTTP2_REF_TRANSPORT(t, r) \
810  grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__)
811 #define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) \
812  grpc_chttp2_unref_transport(t, r, __FILE__, __LINE__)
814  const char* reason, const char* file,
815  int line) {
816  if (t->refs.Unref(grpc_core::DebugLocation(file, line), reason)) {
817  delete t;
818  }
819 }
821  const char* reason, const char* file,
822  int line) {
823  t->refs.Ref(grpc_core::DebugLocation(file, line), reason);
824 }
825 #else
826 #define GRPC_CHTTP2_REF_TRANSPORT(t, r) grpc_chttp2_ref_transport(t)
827 #define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) grpc_chttp2_unref_transport(t)
829  if (t->refs.Unref()) {
830  delete t;
831  }
832 }
834  t->refs.Ref();
835 }
836 #endif
837 
838 void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id);
839 
845 
849  grpc_chttp2_stream* s);
850 
852  grpc_error* due_to_error);
853 
855  grpc_chttp2_stream* s);
857  grpc_chttp2_stream* s);
859  grpc_chttp2_stream* s);
860 
862  grpc_chttp2_stream* s, grpc_error* error);
863 
867  bool is_client);
868 
869 void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error* error);
870 
871 #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H */
Definition: internal.h:168
grpc_closure destroy_stream
Definition: internal.h:523
void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport *t)
Definition: parsing.cc:342
grpc_closure * destroy_stream_arg
Definition: internal.h:524
void PublishError(grpc_error *error)
Definition: chttp2_transport.cc:3100
void grpc_chttp2_list_add_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:186
Definition: internal.h:155
grpc_closure * recv_initial_metadata_ready
Definition: internal.h:548
grpc_slice_buffer frame_storage
Definition: internal.h:585
grpc_millis min_sent_ping_interval_without_data
Definition: internal.h:117
Definition: internal.h:205
Definition: internal.h:158
grpc_chttp2_keepalive_state keepalive_state
keep-alive state machine state
Definition: internal.h:488
int64_t grpc_millis
Definition: exec_ctx.h:35
Definition: internal.h:128
Definition: internal.h:139
Definition: internal.h:66
Definition: arena.h:44
Definition: internal.h:153
grpc_chttp2_stream_list_id
Definition: internal.h:54
grpc_closure * on_complete
Definition: internal.h:276
void Unref()
Definition: internal.h:240
void grpc_chttp2_ack_ping(grpc_chttp2_transport *t, uint64_t id)
Definition: chttp2_transport.cc:1754
union grpc_chttp2_transport::@11 simple
simple one shot parsers
Chttp2IncomingByteStream(grpc_chttp2_transport *transport, grpc_chttp2_stream *stream, uint32_t frame_size, uint32_t flags)
Definition: chttp2_transport.cc:2953
void grpc_chttp2_list_remove_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:197
grpc_slice_buffer outbuf
data to write now
Definition: internal.h:347
grpc_timer delayed_ping_timer
Definition: internal.h:124
size_t byte_counter
Byte counter for number of bytes written.
Definition: internal.h:647
grpc_timer next_bdp_ping_timer
Definition: internal.h:464
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice.cc:40
#define GRPC_CLOSURE_LIST_INIT
Definition: closure.h:168
Definition: internal.h:121
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:1880
bool grpc_chttp2_list_pop_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:208
An array of arguments that can be passed around.
Definition: grpc_types.h:132
grpc_core::Combiner * combiner
Definition: internal.h:303
int64_t next_message_end_offset
Definition: internal.h:541
int64_t initial_window_update
initial window change.
Definition: internal.h:417
Reffer(grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:620
grpc_metadata_batch * recv_trailing_metadata
Definition: internal.h:552
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_closure **pclosure, grpc_error *error, const char *desc)
Definition: chttp2_transport.cc:1185
grpc_closure keepalive_watchdog_fired_locked
Closrue to run when the keepalive ping timeouts.
Definition: internal.h:474
grpc_chttp2_data_parser data_parser
parsing state for data frames
Definition: internal.h:612
Definition: internal.h:62
Definition: metadata_batch.h:49
Definition: internal.h:144
Definition: internal.h:173
void Orphan() override
Definition: chttp2_transport.cc:2976
grpc_closure * fetching_send_message_finished
Definition: internal.h:545
Definition: http2_settings.h:33
grpc_stream_compression_method
Definition: stream_compression.h:38
grpc_chttp2_write_state write_state
write execution state of the transport
Definition: internal.h:308
Definition: frame_rst_stream.h:28
Definition: internal.h:502
grpc_error * closed_with_error
has the upper layer closed the transport?
Definition: internal.h:313
grpc_slice_buffer decompressed_data_buffer
Temporary buffer storing decompressed data.
Definition: internal.h:663
Definition: stream_map.h:32
grpc_chttp2_write_cb * write_cb_pool
Definition: internal.h:436
grpc_error * Push(const grpc_slice &slice, grpc_slice *slice_out)
Definition: chttp2_transport.cc:3110
bool sent_initial_metadata
Definition: internal.h:616
Definition: transport.h:56
Definition: internal.h:114
Definition: debug_location.h:31
bool grpc_chttp2_list_pop_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:176
grpc_core::RefCountedPtr< grpc_core::channelz::SocketNode > channelz_socket
Definition: internal.h:490
Definition: internal.h:72
void grpc_chttp2_initiate_write(grpc_chttp2_transport *t, grpc_chttp2_initiate_write_reason reason)
Transport writing call flow: grpc_chttp2_initiate_write() is called anywhere that we know bytes need ...
Definition: chttp2_transport.cc:884
grpc_core::RefCount refs
Definition: internal.h:297
grpc_closure finish_bdp_ping_locked
Definition: internal.h:441
grpc_resource_user * resource_user
Definition: internal.h:301
Definition: internal.h:56
Definition: internal.h:152
Definition: internal.h:157
Definition: internal.h:147
void grpc_chttp2_unref_transport(grpc_chttp2_transport *t, const char *reason, const char *file, int line)
Definition: internal.h:813
bool write_closed
Is this stream closed for writing.
Definition: internal.h:559
Definition: hpack_encoder.h:41
void * context
Definition: internal.h:513
void Ref(Value n=1)
Definition: ref_counted.h:88
bool keepalive_permit_without_calls
if keepalive pings are allowed when there&#39;s no outstanding streams
Definition: internal.h:484
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
Definition: internal.h:77
Definition: internal.h:146
size_t decompressed_header_bytes
gRPC header bytes that are already decompressed
Definition: internal.h:645
#define GPR_UNLIKELY(x)
Definition: port_platform.h:702
uint8_t endpoint_reading
is there a read request to the endpoint outstanding?
Definition: internal.h:316
int ping_strikes
Definition: internal.h:130
Definition: error_internal.h:39
Definition: hpack_parser.h:47
Definition: internal.h:58
uint32_t flags() const
Definition: byte_stream.h:66
struct grpc_chttp2_write_cb grpc_chttp2_write_cb
bool grpc_chttp2_list_pop_writing_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:166
grpc_closure_list run_after_write
Definition: internal.h:448
struct grpc_chttp2_stream::Reffer reffer
int64_t flow_controlled_bytes_written
Definition: internal.h:542
grpc_chttp2_hpack_parser hpack_parser
parser for headers
Definition: internal.h:398
Definition: internal.h:201
grpc_closure retry_initiate_ping_locked
Definition: internal.h:389
Definition: flow_control.h:393
uint8_t destroying
is the transport destroying itself?
Definition: internal.h:311
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:141
Definition: internal.h:154
bool dirtied_local_settings
are the local settings dirty and need to be sent?
Definition: internal.h:367
char * peer_string
Definition: internal.h:299
Definition: internal.h:169
bool benign_reclaimer_registered
have we scheduled a benign cleanup?
Definition: internal.h:452
Definition: internal.h:150
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:68
uint8_t header_eof
Definition: internal.h:423
uint32_t write_buffer_size
how much data are we willing to buffer when the WRITE_BUFFER_HINT is set?
Definition: internal.h:358
uint64_t ping_ctr
Definition: internal.h:388
grpc_error * Finished(grpc_error *error, bool reset_on_error)
Definition: chttp2_transport.cc:3128
grpc_core::PolymorphicManualConstructor< grpc_core::chttp2::StreamFlowControlBase, grpc_core::chttp2::StreamFlowControl, grpc_core::chttp2::StreamFlowControlDisabled > flow_control
Definition: internal.h:623
#define GRPC_MILLIS_INF_FUTURE
Definition: exec_ctx.h:37
Definition: internal.h:287
Definition: internal.h:290
grpc_timer keepalive_watchdog_timer
watchdog to kill the transport when waiting for the keepalive ping
Definition: internal.h:478
Definition: internal.h:213
void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
add a ref to the stream and add it to the writable list; ref will be dropped in writing.c
Definition: chttp2_transport.cc:924
Definition: internal.h:151
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:78
Definition: stream_compression.h:34
Definition: ref_counted.h:62
Definition: internal.h:195
int64_t call_at_byte
Definition: internal.h:206
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(grpc_chttp2_transport *t)
Definition: writing.cc:632
bool received_last_frame
Definition: internal.h:600
bool final_metadata_requested
Definition: internal.h:581
bool eos_sent
Definition: internal.h:573
size_t max_size_hint
Definition: internal.h:275
Definition: closure.h:41
void * grpc_chttp2_stream_map_find(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:145
grpc_chttp2_server_ping_recv_state ping_recv_state
Definition: internal.h:395
Definition: transport.h:128
Definition: internal.h:148
grpc_metadata_batch * send_trailing_metadata
Definition: internal.h:535
grpc_slice_buffer compressed_data_buffer
Buffer storing data that is compressed but not sent.
Definition: internal.h:655
void * parser_data
Definition: internal.h:430
Round Robin Policy.
Definition: backend_metric.cc:24
grpc_chttp2_stream * incoming_stream
Definition: internal.h:431
bool read_closed
Is this stream reading half-closed.
Definition: internal.h:561
grpc_chttp2_optimization_target
Definition: internal.h:71
Definition: stream_compression.h:40
uint8_t incoming_frame_flags
Definition: internal.h:422
void grpc_chttp2_start_writing(grpc_chttp2_transport *t)
bool is_client
is this a client?
Definition: internal.h:351
bool writing
are we writing?
Definition: internal.h:683
size_t ping_ack_count
ping acks
Definition: internal.h:392
#define GRPC_CHTTP2_NUM_SETTINGS
Definition: http2_settings.h:39
bool grpc_chttp2_list_have_writing_streams(grpc_chttp2_transport *t)
Definition: stream_lists.cc:162
Definition: internal.h:681
grpc_chttp2_write_cb * on_write_finished_cbs
Definition: internal.h:628
Definition: internal.h:165
uint32_t remaining_bytes() const
Definition: internal.h:252
Definition: internal.h:141
grpc_chttp2_stream_link links[STREAM_LIST_COUNT]
Definition: internal.h:526
grpc_closure * on_next
Definition: internal.h:587
void grpc_chttp2_fake_status(grpc_chttp2_transport *t, grpc_chttp2_stream *stream, grpc_error *error)
Definition: chttp2_transport.cc:2096
grpc_chttp2_sent_goaway_state sent_goaway_state
Definition: internal.h:364
grpc_closure write_action_end_locked
Definition: internal.h:326
grpc_closure complete_fetch_locked
Definition: internal.h:544
uint32_t fetched_send_message_length
Definition: internal.h:539
Definition: internal.h:143
Definition: internal.h:136
bool early_results_scheduled
did we queue any completions as part of beginning the write
Definition: internal.h:687
grpc_chttp2_hpack_compressor hpack_compressor
hpack encoding
Definition: internal.h:349
Definition: internal.h:176
bool grpc_chttp2_list_remove_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:152
Definition: internal.h:163
uint8_t incoming_frame_type
Definition: internal.h:421
grpc_closure * recv_trailing_metadata_finished
Definition: internal.h:553
Definition: internal.h:196
Definition: flow_control.h:339
grpc_slice_buffer flow_controlled_buffer
Definition: internal.h:625
Definition: byte_stream.h:36
bool sent_local_settings
have local settings been sent?
Definition: internal.h:369
Definition: combiner.h:33
uint32_t num_pending_induced_frames
The number of pending induced frames (SETTINGS_ACK, PINGS_ACK and RST_STREAM) in the outgoing buffer ...
Definition: internal.h:497
Definition: internal.h:67
void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:1965
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: chttp2_transport.cc:1863
Definition: internal.h:109
grpc_chttp2_stream ** accepting_stream
address to place a newly accepted stream - set and unset by grpc_chttp2_parsing_accept_stream; used b...
Definition: internal.h:336
Definition: internal.h:193
Definition: flow_control.h:222
grpc_millis keepalive_time
time duration in between pings
Definition: internal.h:480
Definition: internal.h:508
size_t unprocessed_incoming_frames_buffer_cached_length
Definition: internal.h:593
grpc_error * byte_stream_error
Definition: internal.h:599
grpc_chttp2_deframe_transport_state
Definition: internal.h:134
grpc_chttp2_stream * grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport *t, uint32_t id)
Definition: chttp2_transport.cc:753
const char * grpc_chttp2_initiate_write_reason_string(grpc_chttp2_initiate_write_reason reason)
Definition: chttp2_transport.cc:3253
grpc_millis min_recv_ping_interval_without_data
Definition: internal.h:118
grpc_stream_refcount * refcount
Definition: internal.h:515
void grpc_chttp2_retry_initiate_ping(void *tp, grpc_error *error)
Definition: chttp2_transport.cc:1738
Definition: resource_quota.cc:63
Definition: manual_constructor.h:104
grpc_closure destructive_reclaimer_locked
destructive cleanup closure
Definition: internal.h:458
grpc_slice fetching_slice
Definition: internal.h:540
grpc_error * Pull(grpc_slice *slice) override
Definition: chttp2_transport.cc:3055
grpc_chttp2_transport * t
Definition: internal.h:514
int64_t flow_controlled_bytes_flowed
Definition: internal.h:543
uint32_t force_send_settings
bitmask of setting indexes to send out Hack: it&#39;s common for implementations to assume 65536 bytes in...
Definition: internal.h:373
void * accept_stream_cb_user_data
Definition: internal.h:341
Definition: frame_goaway.h:40
bool keepalive_ping_started
If start_keepalive_ping_locked has been called.
Definition: internal.h:486
grpc_published_metadata_method
Definition: internal.h:501
~grpc_chttp2_transport()
Definition: chttp2_transport.cc:175
grpc_slice_buffer unprocessed_incoming_frames_buffer
Definition: internal.h:597
grpc_stream_compression_method stream_compression_method
Definition: internal.h:633
void grpc_chttp2_list_add_written_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
uint32_t incoming_stream_id
Definition: internal.h:427
bool reading_paused_on_pending_induced_frames
Definition: internal.h:498
Definition: internal.h:505
grpc_closure benign_reclaimer_locked
benign cleanup closure
Definition: internal.h:456
bool grpc_chttp2_list_pop_stalled_by_transport(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Definition: stream_lists.cc:192
grpc_chttp2_stream * head
Definition: internal.h:177
grpc_chttp2_stream * grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport *t, uint32_t id)
Definition: internal.h:749
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport *t, uint32_t goaway_error, uint32_t last_stream_id, const grpc_slice &goaway_text)
Definition: chttp2_transport.cc:1066
~grpc_chttp2_stream()
Definition: chttp2_transport.cc:658
uint32_t settings[GRPC_NUM_SETTING_SETS][GRPC_CHTTP2_NUM_SETTINGS]
settings values
Definition: internal.h:375
grpc_chttp2_sent_goaway_state
Definition: internal.h:199
grpc_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client, grpc_resource_user *resource_user)
Definition: chttp2_transport.cc:440
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error *error)
Definition: chttp2_transport.cc:2174
Definition: frame_ping.h:27
Definition: internal.h:189
Definition: internal.h:162
grpc_chttp2_window_update_parser window_update
Definition: internal.h:401
grpc_endpoint * ep
Definition: internal.h:298
Definition: internal.h:149
Definition: internal.h:159
uint32_t next_stream_id
what is the next stream id to be allocated by this peer? copied to next_stream_id in parsing when par...
Definition: internal.h:379
uint32_t incoming_frame_size
Definition: internal.h:426
Definition: internal.h:284
Definition: flow_control.h:57
Definition: internal.h:200
Definition: internal.h:73
Definition: internal.h:167
void Shutdown(grpc_error *error) override
Definition: chttp2_transport.cc:3143
Definition: internal.h:164
size_t sending_bytes
Definition: internal.h:630
bool sent_trailing_metadata
Definition: internal.h:617
bool destructive_reclaimer_registered
have we scheduled a destructive cleanup?
Definition: internal.h:454
grpc_closure * notify_on_receive_settings
Definition: internal.h:305
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message
Definition: internal.h:550
Definition: internal.h:79
grpc_chttp2_stream(grpc_chttp2_transport *t, grpc_stream_refcount *refcount, const void *server_data, grpc_core::Arena *arena)
Definition: chttp2_transport.cc:628
grpc_chttp2_goaway_parser goaway_parser
parser for goaway frames
Definition: internal.h:407
grpc_metadata_batch * send_initial_metadata
things the upper layers would like to send
Definition: internal.h:533
Definition: internal.h:80
grpc_error * forced_close_error
saw some stream level error
Definition: internal.h:605
int pings_before_data_required
Definition: internal.h:123
void grpc_chttp2_stream_unref(grpc_chttp2_stream *s, const char *reason)
Definition: chttp2_transport.cc:608
Definition: internal.h:137
grpc_chttp2_stream_map stream_map
maps stream id to grpc_chttp2_stream objects
Definition: internal.h:322
grpc_closure start_keepalive_ping_locked
Closure to run when the keepalive ping is sent.
Definition: internal.h:470
grpc_chttp2_repeated_ping_state ping_state
Definition: internal.h:387
grpc_error * close_transport_on_writes_finished
Definition: internal.h:445
void grpc_chttp2_add_ping_strike(grpc_chttp2_transport *t)
Add a new ping strike to ping_recv_state.ping_strikes.
Definition: chttp2_transport.cc:1785
bool Unref()
Definition: ref_counted.h:174
bool seen_error
Has this stream seen an error.
Definition: internal.h:566
bool is_delayed_ping_timer_set
Definition: internal.h:125
A list of RPC Contexts.
Definition: context_list.h:30
Definition: internal.h:78
grpc_published_metadata_method published_metadata[2]
Definition: internal.h:580
Definition: internal.h:171
grpc_millis keepalive_timeout
grace period for a ping to complete before watchdog kicks in
Definition: internal.h:482
Definition: flow_control.h:145
grpc_timer keepalive_ping_timer
timer to initiate ping events
Definition: internal.h:476
Definition: internal.h:503
int max_ping_strikes
Definition: internal.h:116
grpc_closure read_action_locked
Definition: internal.h:328
Definition: internal.h:504
grpc_chttp2_ping_closure_list
Definition: internal.h:76
bool write_buffering
Are we buffering writes on this stream? If yes, we won&#39;t become writable until there&#39;s enough queued ...
Definition: internal.h:569
void Ref()
Definition: internal.h:239
void grpc_chttp2_end_write(grpc_chttp2_transport *t, grpc_error *error)
Definition: writing.cc:679
grpc_closure write_action_begin_locked
Definition: internal.h:324
Definition: incoming_metadata.h:26
grpc_transport_stream_stats stats
Definition: internal.h:556
size_t uncompressed_data_size
Amount of uncompressed bytes sent out when compressed_data_buffer is emptied.
Definition: internal.h:651
grpc_error * read_closed_error
the error that resulted in this stream being read-closed
Definition: internal.h:576
Definition: frame_settings.h:37
grpc_closure * recv_message_ready
Definition: internal.h:551
grpc_chttp2_ping_queue ping_queue
ping queues for various ping insertion points
Definition: internal.h:385
grpc_stream_compression_context * stream_decompression_ctx
Stream compression decompress context.
Definition: internal.h:658
Definition: frame_window_update.h:28
Definition: timer.h:30
bool grpc_chttp2_list_pop_written_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
grpc_millis deadline
Definition: internal.h:602
grpc_closure * send_initial_metadata_finished
Definition: internal.h:534
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
grpc_core::OrphanablePtr< grpc_core::ByteStream > fetching_send_message
Definition: internal.h:538
grpc_millis last_ping_recv_time
Definition: internal.h:129
grpc_slice_buffer qbuf
data to write next write
Definition: internal.h:354
bool grpc_chttp2_list_pop_writable_stream(grpc_chttp2_transport *t, grpc_chttp2_stream **s)
Get a writable stream returns non-zero if there was a stream available.
Definition: stream_lists.cc:147
Definition: internal.h:145
grpc_chttp2_keepalive_state
Definition: internal.h:283
int64_t received_bytes
number of bytes received - reset at end of parse thread execution
Definition: internal.h:614
grpc_closure init_keepalive_ping_locked
Closure to initialize a keepalive ping.
Definition: internal.h:468
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:125
Definition: internal.h:166
bool unprocessed_incoming_frames_decompressed
Whether bytes stored in unprocessed_incoming_byte_stream is decompressed.
Definition: internal.h:641
bool Next(size_t max_size_hint, grpc_closure *on_complete) override
Definition: chttp2_transport.cc:3029
bool * trailing_metadata_available
Definition: internal.h:549
bool all_incoming_byte_streams_finished
Are all published incoming byte streams closed.
Definition: internal.h:563
void grpc_chttp2_list_remove_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:181
Definition: internal.h:286
bool is_first_frame
Definition: internal.h:424
Definition: internal.h:138
Definition: frame_data.h:46
Definition: endpoint.h:102
grpc_error * goaway_error
Set to a grpc_error object if a goaway frame is received.
Definition: internal.h:362
grpc_core::PolymorphicManualConstructor< grpc_core::chttp2::TransportFlowControlBase, grpc_core::chttp2::TransportFlowControl, grpc_core::chttp2::TransportFlowControlDisabled > flow_control
Definition: internal.h:413
grpc_closure start_bdp_ping_locked
Definition: internal.h:440
void grpc_chttp2_cancel_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_error *due_to_error)
Definition: chttp2_transport.cc:2072
bool eos_received
Definition: internal.h:572
grpc_chttp2_ping_parser ping
Definition: internal.h:403
grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]
Definition: internal.h:583
Definition: stream_compression.h:39
size_t ping_ack_capacity
Definition: internal.h:393
grpc_chttp2_write_cb * on_flow_controlled_cbs
Definition: internal.h:627
bool have_next_bdp_ping_timer
Definition: internal.h:461
bool bdp_ping_started
If start_bdp_ping_locked has been called.
Definition: internal.h:463
grpc_closure * send_trailing_metadata_finished
Definition: internal.h:536
Definition: flow_control.h:411
grpc_chttp2_setting_set
Definition: internal.h:187
Definition: internal.h:140
grpc_chttp2_write_state
Definition: internal.h:65
uint64_t * ping_acks
Definition: internal.h:394
grpc_chttp2_stream * tail
Definition: internal.h:178
grpc_error * write_closed_error
the error that resulted in this stream being write-closed
Definition: internal.h:578
grpc_slice_buffer read_buffer
incoming read bytes
Definition: internal.h:331
Definition: internal.h:57
Definition: internal.h:202
Definition: transport_impl.h:66
Definition: internal.h:285
grpc_stream_compression_context * stream_compression_ctx
Stream compression compress context.
Definition: internal.h:653
bool partial
if writing: was it a complete flush (false) or a partial flush (true)
Definition: internal.h:685
bool grpc_chttp2_list_add_writing_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:157
uint32_t last_new_stream_id
last new stream id
Definition: internal.h:382
void grpc_chttp2_list_add_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:202
grpc_stream_compression_method stream_decompression_method
Definition: internal.h:636
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:2448
void(* accept_stream_cb)(void *user_data, grpc_transport *transport, const void *server_data)
Definition: internal.h:339
Definition: internal.h:142
int max_pings_without_data
Definition: internal.h:115
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport *t, grpc_chttp2_stream *s, int close_reads, int close_writes, grpc_error *error)
Definition: chttp2_transport.cc:2196
Definition: internal.h:191
grpc_transport base
Definition: internal.h:296
grpc_core::ConnectivityStateTracker state_tracker
connectivity tracking
Definition: internal.h:344
Definition: internal.h:55
grpc_metadata_batch * recv_initial_metadata
Definition: internal.h:547
grpc_chttp2_deframe_transport_state deframe_state
Definition: internal.h:420
bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:213
grpc_chttp2_rst_stream_parser rst_stream
Definition: internal.h:404
grpc_chttp2_write_cb * finish_after_write
Definition: internal.h:629
grpc_closure next_bdp_ping_timer_expired_locked
Definition: internal.h:439
grpc_closure finish_keepalive_ping_locked
Cousure to run when the keepalive ping ack is received.
Definition: internal.h:472
bool traced
Whether the bytes needs to be traced using Fathom.
Definition: internal.h:643
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args *args, bool is_client)
Set the default keepalive configurations, must only be called at initialization.
Definition: chttp2_transport.cc:2699
uint32_t num_messages_in_next_write
Definition: internal.h:491
void grpc_chttp2_stream_ref(grpc_chttp2_stream *s, const char *reason)
Definition: chttp2_transport.cc:605
Definition: internal.h:92
grpc_closure * closure
Definition: internal.h:207
Definition: internal.h:519
grpc_error * grpc_chttp2_perform_read(grpc_chttp2_transport *t, const grpc_slice &slice)
Process one slice of incoming data; return 1 if the connection is still viable after reading...
Definition: parsing.cc:52
uint32_t expect_continuation_stream_id
Definition: internal.h:425
void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason, const char *file, int line)
Definition: internal.h:820
uint8_t included[STREAM_LIST_COUNT]
Definition: internal.h:527
grpc_millis last_ping_sent_time
Definition: internal.h:122
grpc_closure closure
Definition: internal.h:274
void grpc_chttp2_list_add_waiting_for_concurrency(grpc_chttp2_transport *t, grpc_chttp2_stream *s)
Definition: stream_lists.cc:171
streams that are waiting to start because there are too many concurrent streams on the connection ...
Definition: internal.h:61
Definition: connectivity_state.h:89
grpc_chttp2_settings_parser settings
Definition: internal.h:402
grpc_transport_stream_stats * collecting_stats
Definition: internal.h:555
grpc_chttp2_repeated_ping_policy ping_policy
Definition: internal.h:386
grpc_chttp2_initiate_write_reason
Definition: internal.h:83
Definition: internal.h:156
uint8_t header_frames_received
how many header frames have we received?
Definition: internal.h:607
grpc_closure reset_byte_stream
Definition: internal.h:598
grpc_closure write_action
Definition: internal.h:325
grpc_core::ContextList * cl
Definition: internal.h:489
struct grpc_chttp2_write_cb * next
Definition: internal.h:208
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT]
various lists of streams
Definition: internal.h:319
bool pending_byte_stream
Definition: internal.h:588