@@ -40,7 +40,7 @@ inline int Nghttp2Session::OnNghttpError(nghttp2_session* session,
4040 void * user_data) {
4141 Nghttp2Session* handle = static_cast <Nghttp2Session*>(user_data);
4242 DEBUG_HTTP2 (" Nghttp2Session %s: Error '%.*s'\n " ,
43- handle->TypeName (), len, message);
43+ handle->TypeName (handle-> type () ), len, message);
4444 return 0 ;
4545}
4646#endif
@@ -56,7 +56,7 @@ inline int Nghttp2Session::OnBeginHeadersCallback(nghttp2_session* session,
5656 frame->push_promise .promised_stream_id :
5757 frame->hd .stream_id ;
5858 DEBUG_HTTP2 (" Nghttp2Session %s: beginning headers for stream %d\n " ,
59- handle->TypeName (), id);
59+ handle->TypeName (handle-> type () ), id);
6060
6161 Nghttp2Stream* stream = handle->FindStream (id);
6262 if (stream == nullptr ) {
@@ -99,7 +99,7 @@ inline int Nghttp2Session::OnFrameReceive(nghttp2_session* session,
9999 void * user_data) {
100100 Nghttp2Session* handle = static_cast <Nghttp2Session*>(user_data);
101101 DEBUG_HTTP2 (" Nghttp2Session %s: complete frame received: type: %d\n " ,
102- handle->TypeName (), frame->hd .type );
102+ handle->TypeName (handle-> type () ), frame->hd .type );
103103 bool ack;
104104 switch (frame->hd .type ) {
105105 case NGHTTP2_DATA:
@@ -131,7 +131,7 @@ inline int Nghttp2Session::OnFrameNotSent(nghttp2_session *session,
131131 void *user_data) {
132132 Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
133133 DEBUG_HTTP2 (" Nghttp2Session %s: frame type %d was not sent, code: %d\n " ,
134- handle->TypeName (), frame->hd .type , error_code);
134+ handle->TypeName (handle-> type () ), frame->hd .type , error_code);
135135 // Do not report if the frame was not sent due to the session closing
136136 if (error_code != NGHTTP2_ERR_SESSION_CLOSING &&
137137 error_code != NGHTTP2_ERR_STREAM_CLOSED &&
@@ -158,7 +158,7 @@ inline int Nghttp2Session::OnStreamClose(nghttp2_session *session,
158158 void *user_data) {
159159 Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
160160 DEBUG_HTTP2 (" Nghttp2Session %s: stream %d closed, code: %d\n " ,
161- handle->TypeName (), id, code);
161+ handle->TypeName (handle-> type () ), id, code);
162162 Nghttp2Stream *stream = handle->FindStream (id);
163163 // Intentionally ignore the callback if the stream does not exist
164164 if (stream != nullptr )
@@ -178,7 +178,7 @@ inline ssize_t Nghttp2Session::OnStreamReadFD(nghttp2_session *session,
178178 void *user_data) {
179179 Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
180180 DEBUG_HTTP2 (" Nghttp2Session %s: reading outbound file data for stream %d\n " ,
181- handle->TypeName (), id);
181+ handle->TypeName (handle-> type () ), id);
182182 Nghttp2Stream *stream = handle->FindStream (id);
183183
184184 int fd = source->fd ;
@@ -214,7 +214,7 @@ inline ssize_t Nghttp2Session::OnStreamReadFD(nghttp2_session *session,
214214 // if numchars < length, assume that we are done.
215215 if (static_cast <size_t >(numchars) < length || length <= 0 ) {
216216 DEBUG_HTTP2 (" Nghttp2Session %s: no more data for stream %d\n " ,
217- handle->TypeName (), id);
217+ handle->TypeName (handle-> type () ), id);
218218 *flags |= NGHTTP2_DATA_FLAG_EOF;
219219 GetTrailers (session, handle, stream, flags);
220220 }
@@ -234,7 +234,7 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
234234 void *user_data) {
235235 Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
236236 DEBUG_HTTP2 (" Nghttp2Session %s: reading outbound data for stream %d\n " ,
237- handle->TypeName (), id);
237+ handle->TypeName (handle-> type () ), id);
238238 Nghttp2Stream *stream = handle->FindStream (id);
239239 size_t remaining = length;
240240 size_t offset = 0 ;
@@ -244,7 +244,7 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
244244 // calls this callback.
245245 while (stream->queue_head_ != nullptr ) {
246246 DEBUG_HTTP2 (" Nghttp2Session %s: processing outbound data chunk\n " ,
247- handle->TypeName ());
247+ handle->TypeName (handle-> type () ));
248248 nghttp2_stream_write_queue *head = stream->queue_head_ ;
249249 while (stream->queue_head_index_ < head->nbufs ) {
250250 if (remaining == 0 )
@@ -285,12 +285,12 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
285285 int writable = stream->queue_head_ != nullptr || stream->IsWritable ();
286286 if (offset == 0 && writable && stream->queue_head_ == nullptr ) {
287287 DEBUG_HTTP2 (" Nghttp2Session %s: deferring stream %d\n " ,
288- handle->TypeName (), id);
288+ handle->TypeName (handle-> type () ), id);
289289 return NGHTTP2_ERR_DEFERRED;
290290 }
291291 if (!writable) {
292292 DEBUG_HTTP2 (" Nghttp2Session %s: no more data for stream %d\n " ,
293- handle->TypeName (), id);
293+ handle->TypeName (handle-> type () ), id);
294294 *flags |= NGHTTP2_DATA_FLAG_EOF;
295295
296296 GetTrailers (session, handle, stream, flags);
@@ -309,7 +309,7 @@ inline ssize_t Nghttp2Session::OnSelectPadding(nghttp2_session *session,
309309 CHECK (handle->HasGetPaddingCallback ());
310310 ssize_t padding = handle->GetPadding (frame->hd .length , maxPayloadLen);
311311 DEBUG_HTTP2 (" Nghttp2Session %s: using padding, size: %d\n " ,
312- handle->TypeName (), padding);
312+ handle->TypeName (handle-> type () ), padding);
313313 return padding;
314314}
315315
@@ -322,7 +322,8 @@ inline int Nghttp2Session::OnDataChunkReceived(nghttp2_session *session,
322322 void *user_data) {
323323 Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
324324 DEBUG_HTTP2 (" Nghttp2Session %s: buffering data chunk for stream %d, size: "
325- " %d, flags: %d\n " , handle->TypeName (), id, len, flags);
325+ " %d, flags: %d\n " , handle->TypeName (handle->type ()),
326+ id, len, flags);
326327 Nghttp2Stream *stream = handle->FindStream (id);
327328 nghttp2_data_chunk_t *chunk = data_chunk_free_list.pop ();
328329 chunk->buf = uv_buf_init (new char [len], len);
@@ -356,7 +357,8 @@ inline void Nghttp2Session::SubmitTrailers::Submit(nghttp2_nv *trailers,
356357 if (length == 0 )
357358 return ;
358359 DEBUG_HTTP2 (" Nghttp2Session %s: sending trailers for stream %d, "
359- " count: %d\n " , handle_->TypeName (), stream_->id (), length);
360+ " count: %d\n " , handle_->TypeName (handle_->type ()),
361+ stream_->id (), length);
360362 *flags_ |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
361363 nghttp2_submit_trailer (handle_->session_ ,
362364 stream_->id (),
@@ -366,7 +368,8 @@ inline void Nghttp2Session::SubmitTrailers::Submit(nghttp2_nv *trailers,
366368
367369// See: https://nghttp2.org/documentation/nghttp2_submit_shutdown_notice.html
368370inline void Nghttp2Session::SubmitShutdownNotice () {
369- DEBUG_HTTP2 (" Nghttp2Session %s: submitting shutdown notice\n " , TypeName ());
371+ DEBUG_HTTP2 (" Nghttp2Session %s: submitting shutdown notice\n " ,
372+ TypeName (type ()));
370373 nghttp2_submit_shutdown_notice (session_);
371374}
372375
@@ -376,7 +379,7 @@ inline void Nghttp2Session::SubmitShutdownNotice() {
376379inline int Nghttp2Session::SubmitSettings (const nghttp2_settings_entry iv[],
377380 size_t niv) {
378381 DEBUG_HTTP2 (" Nghttp2Session %s: submitting settings, count: %d\n " ,
379- TypeName (), niv);
382+ TypeName (type () ), niv);
380383 return nghttp2_submit_settings (session_, NGHTTP2_FLAG_NONE, iv, niv);
381384}
382385
@@ -385,11 +388,11 @@ inline Nghttp2Stream* Nghttp2Session::FindStream(int32_t id) {
385388 auto s = streams_.find (id);
386389 if (s != streams_.end ()) {
387390 DEBUG_HTTP2 (" Nghttp2Session %s: stream %d found\n " ,
388- TypeName (), id);
391+ TypeName (type () ), id);
389392 return s->second ;
390393 } else {
391394 DEBUG_HTTP2 (" Nghttp2Session %s: stream %d not found\n " ,
392- TypeName (), id);
395+ TypeName (type () ), id);
393396 return nullptr ;
394397 }
395398}
@@ -414,7 +417,7 @@ inline void Nghttp2Stream::FlushDataChunks(bool done) {
414417inline void Nghttp2Session::HandleDataFrame (const nghttp2_frame* frame) {
415418 int32_t id = frame->hd .stream_id ;
416419 DEBUG_HTTP2 (" Nghttp2Session %s: handling data frame for stream %d\n " ,
417- TypeName (), id);
420+ TypeName (type () ), id);
418421 Nghttp2Stream* stream = this ->FindStream (id);
419422 // If the stream does not exist, something really bad happened
420423 CHECK_NE (stream, nullptr );
@@ -430,7 +433,7 @@ inline void Nghttp2Session::HandleHeadersFrame(const nghttp2_frame* frame) {
430433 int32_t id = (frame->hd .type == NGHTTP2_PUSH_PROMISE) ?
431434 frame->push_promise .promised_stream_id : frame->hd .stream_id ;
432435 DEBUG_HTTP2 (" Nghttp2Session %s: handling headers frame for stream %d\n " ,
433- TypeName (), id);
436+ TypeName (type () ), id);
434437 Nghttp2Stream* stream = FindStream (id);
435438 // If the stream does not exist, something really bad happened
436439 CHECK_NE (stream, nullptr );
@@ -446,7 +449,7 @@ inline void Nghttp2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
446449 nghttp2_priority priority_frame = frame->priority ;
447450 int32_t id = frame->hd .stream_id ;
448451 DEBUG_HTTP2 (" Nghttp2Session %s: handling priority frame for stream %d\n " ,
449- TypeName (), id);
452+ TypeName (type () ), id);
450453 // Ignore the priority frame if stream ID is <= 0
451454 // This actually should never happen because nghttp2 should treat this as
452455 // an error condition that terminates the session.
@@ -459,7 +462,7 @@ inline void Nghttp2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
459462// Notifies the JS layer that a GOAWAY frame has been received
460463inline void Nghttp2Session::HandleGoawayFrame (const nghttp2_frame* frame) {
461464 nghttp2_goaway goaway_frame = frame->goaway ;
462- DEBUG_HTTP2 (" Nghttp2Session %s: handling goaway frame\n " , TypeName ());
465+ DEBUG_HTTP2 (" Nghttp2Session %s: handling goaway frame\n " , TypeName (type () ));
463466
464467 OnGoAway (goaway_frame.last_stream_id ,
465468 goaway_frame.error_code ,
@@ -469,7 +472,7 @@ inline void Nghttp2Session::HandleGoawayFrame(const nghttp2_frame* frame) {
469472
470473// Prompts nghttp2 to flush the queue of pending data frames
471474inline void Nghttp2Session::SendPendingData () {
472- DEBUG_HTTP2 (" Nghttp2Session %s: Sending pending data\n " , TypeName ());
475+ DEBUG_HTTP2 (" Nghttp2Session %s: Sending pending data\n " , TypeName (type () ));
473476 // Do not attempt to send data on the socket if the destroying flag has
474477 // been set. That means everything is shutting down and the socket
475478 // will not be usable.
@@ -504,7 +507,7 @@ inline int Nghttp2Session::Init(uv_loop_t* loop,
504507 nghttp2_option* options,
505508 nghttp2_mem* mem) {
506509 DEBUG_HTTP2 (" Nghttp2Session %s: initializing session\n " ,
507- SessionTypeName (type));
510+ TypeName (type));
508511 loop_ = loop;
509512 session_type_ = type;
510513 destroying_ = false ;
@@ -558,7 +561,7 @@ inline void Nghttp2Session::MarkDestroying() {
558561
559562inline int Nghttp2Session::Free () {
560563 CHECK (session_ != nullptr );
561- DEBUG_HTTP2 (" Nghttp2Session %s: freeing session\n " , TypeName ());
564+ DEBUG_HTTP2 (" Nghttp2Session %s: freeing session\n " , TypeName (type () ));
562565 // Stop the loop
563566 uv_prepare_stop (&prep_);
564567 auto PrepClose = [](uv_handle_t * handle) {
@@ -572,7 +575,7 @@ inline int Nghttp2Session::Free() {
572575 nghttp2_session_del (session_);
573576 session_ = nullptr ;
574577 loop_ = nullptr ;
575- DEBUG_HTTP2 (" Nghttp2Session %s: session freed\n " , TypeName ());
578+ DEBUG_HTTP2 (" Nghttp2Session %s: session freed\n " , TypeName (type () ));
576579 return 1 ;
577580}
578581
0 commit comments