@@ -40,7 +40,7 @@ inline int Nghttp2Session::OnNghttpError(nghttp2_session* session,
40
40
void * user_data) {
41
41
Nghttp2Session* handle = static_cast <Nghttp2Session*>(user_data);
42
42
DEBUG_HTTP2 (" Nghttp2Session %s: Error '%.*s'\n " ,
43
- handle->TypeName (), len, message);
43
+ handle->TypeName (handle-> type () ), len, message);
44
44
return 0 ;
45
45
}
46
46
#endif
@@ -56,7 +56,7 @@ inline int Nghttp2Session::OnBeginHeadersCallback(nghttp2_session* session,
56
56
frame->push_promise .promised_stream_id :
57
57
frame->hd .stream_id ;
58
58
DEBUG_HTTP2 (" Nghttp2Session %s: beginning headers for stream %d\n " ,
59
- handle->TypeName (), id);
59
+ handle->TypeName (handle-> type () ), id);
60
60
61
61
Nghttp2Stream* stream = handle->FindStream (id);
62
62
if (stream == nullptr ) {
@@ -99,7 +99,7 @@ inline int Nghttp2Session::OnFrameReceive(nghttp2_session* session,
99
99
void * user_data) {
100
100
Nghttp2Session* handle = static_cast <Nghttp2Session*>(user_data);
101
101
DEBUG_HTTP2 (" Nghttp2Session %s: complete frame received: type: %d\n " ,
102
- handle->TypeName (), frame->hd .type );
102
+ handle->TypeName (handle-> type () ), frame->hd .type );
103
103
bool ack;
104
104
switch (frame->hd .type ) {
105
105
case NGHTTP2_DATA:
@@ -131,7 +131,7 @@ inline int Nghttp2Session::OnFrameNotSent(nghttp2_session *session,
131
131
void *user_data) {
132
132
Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
133
133
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);
135
135
// Do not report if the frame was not sent due to the session closing
136
136
if (error_code != NGHTTP2_ERR_SESSION_CLOSING &&
137
137
error_code != NGHTTP2_ERR_STREAM_CLOSED &&
@@ -158,7 +158,7 @@ inline int Nghttp2Session::OnStreamClose(nghttp2_session *session,
158
158
void *user_data) {
159
159
Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
160
160
DEBUG_HTTP2 (" Nghttp2Session %s: stream %d closed, code: %d\n " ,
161
- handle->TypeName (), id, code);
161
+ handle->TypeName (handle-> type () ), id, code);
162
162
Nghttp2Stream *stream = handle->FindStream (id);
163
163
// Intentionally ignore the callback if the stream does not exist
164
164
if (stream != nullptr )
@@ -178,7 +178,7 @@ inline ssize_t Nghttp2Session::OnStreamReadFD(nghttp2_session *session,
178
178
void *user_data) {
179
179
Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
180
180
DEBUG_HTTP2 (" Nghttp2Session %s: reading outbound file data for stream %d\n " ,
181
- handle->TypeName (), id);
181
+ handle->TypeName (handle-> type () ), id);
182
182
Nghttp2Stream *stream = handle->FindStream (id);
183
183
184
184
int fd = source->fd ;
@@ -214,7 +214,7 @@ inline ssize_t Nghttp2Session::OnStreamReadFD(nghttp2_session *session,
214
214
// if numchars < length, assume that we are done.
215
215
if (static_cast <size_t >(numchars) < length || length <= 0 ) {
216
216
DEBUG_HTTP2 (" Nghttp2Session %s: no more data for stream %d\n " ,
217
- handle->TypeName (), id);
217
+ handle->TypeName (handle-> type () ), id);
218
218
*flags |= NGHTTP2_DATA_FLAG_EOF;
219
219
GetTrailers (session, handle, stream, flags);
220
220
}
@@ -234,7 +234,7 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
234
234
void *user_data) {
235
235
Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
236
236
DEBUG_HTTP2 (" Nghttp2Session %s: reading outbound data for stream %d\n " ,
237
- handle->TypeName (), id);
237
+ handle->TypeName (handle-> type () ), id);
238
238
Nghttp2Stream *stream = handle->FindStream (id);
239
239
size_t remaining = length;
240
240
size_t offset = 0 ;
@@ -244,7 +244,7 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
244
244
// calls this callback.
245
245
while (stream->queue_head_ != nullptr ) {
246
246
DEBUG_HTTP2 (" Nghttp2Session %s: processing outbound data chunk\n " ,
247
- handle->TypeName ());
247
+ handle->TypeName (handle-> type () ));
248
248
nghttp2_stream_write_queue *head = stream->queue_head_ ;
249
249
while (stream->queue_head_index_ < head->nbufs ) {
250
250
if (remaining == 0 )
@@ -285,12 +285,12 @@ inline ssize_t Nghttp2Session::OnStreamRead(nghttp2_session *session,
285
285
int writable = stream->queue_head_ != nullptr || stream->IsWritable ();
286
286
if (offset == 0 && writable && stream->queue_head_ == nullptr ) {
287
287
DEBUG_HTTP2 (" Nghttp2Session %s: deferring stream %d\n " ,
288
- handle->TypeName (), id);
288
+ handle->TypeName (handle-> type () ), id);
289
289
return NGHTTP2_ERR_DEFERRED;
290
290
}
291
291
if (!writable) {
292
292
DEBUG_HTTP2 (" Nghttp2Session %s: no more data for stream %d\n " ,
293
- handle->TypeName (), id);
293
+ handle->TypeName (handle-> type () ), id);
294
294
*flags |= NGHTTP2_DATA_FLAG_EOF;
295
295
296
296
GetTrailers (session, handle, stream, flags);
@@ -309,7 +309,7 @@ inline ssize_t Nghttp2Session::OnSelectPadding(nghttp2_session *session,
309
309
CHECK (handle->HasGetPaddingCallback ());
310
310
ssize_t padding = handle->GetPadding (frame->hd .length , maxPayloadLen);
311
311
DEBUG_HTTP2 (" Nghttp2Session %s: using padding, size: %d\n " ,
312
- handle->TypeName (), padding);
312
+ handle->TypeName (handle-> type () ), padding);
313
313
return padding;
314
314
}
315
315
@@ -322,7 +322,8 @@ inline int Nghttp2Session::OnDataChunkReceived(nghttp2_session *session,
322
322
void *user_data) {
323
323
Nghttp2Session *handle = static_cast <Nghttp2Session *>(user_data);
324
324
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);
326
327
Nghttp2Stream *stream = handle->FindStream (id);
327
328
nghttp2_data_chunk_t *chunk = data_chunk_free_list.pop ();
328
329
chunk->buf = uv_buf_init (new char [len], len);
@@ -356,7 +357,8 @@ inline void Nghttp2Session::SubmitTrailers::Submit(nghttp2_nv *trailers,
356
357
if (length == 0 )
357
358
return ;
358
359
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);
360
362
*flags_ |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
361
363
nghttp2_submit_trailer (handle_->session_ ,
362
364
stream_->id (),
@@ -366,7 +368,8 @@ inline void Nghttp2Session::SubmitTrailers::Submit(nghttp2_nv *trailers,
366
368
367
369
// See: https://nghttp2.org/documentation/nghttp2_submit_shutdown_notice.html
368
370
inline 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 ()));
370
373
nghttp2_submit_shutdown_notice (session_);
371
374
}
372
375
@@ -376,7 +379,7 @@ inline void Nghttp2Session::SubmitShutdownNotice() {
376
379
inline int Nghttp2Session::SubmitSettings (const nghttp2_settings_entry iv[],
377
380
size_t niv) {
378
381
DEBUG_HTTP2 (" Nghttp2Session %s: submitting settings, count: %d\n " ,
379
- TypeName (), niv);
382
+ TypeName (type () ), niv);
380
383
return nghttp2_submit_settings (session_, NGHTTP2_FLAG_NONE, iv, niv);
381
384
}
382
385
@@ -385,11 +388,11 @@ inline Nghttp2Stream* Nghttp2Session::FindStream(int32_t id) {
385
388
auto s = streams_.find (id);
386
389
if (s != streams_.end ()) {
387
390
DEBUG_HTTP2 (" Nghttp2Session %s: stream %d found\n " ,
388
- TypeName (), id);
391
+ TypeName (type () ), id);
389
392
return s->second ;
390
393
} else {
391
394
DEBUG_HTTP2 (" Nghttp2Session %s: stream %d not found\n " ,
392
- TypeName (), id);
395
+ TypeName (type () ), id);
393
396
return nullptr ;
394
397
}
395
398
}
@@ -414,7 +417,7 @@ inline void Nghttp2Stream::FlushDataChunks(bool done) {
414
417
inline void Nghttp2Session::HandleDataFrame (const nghttp2_frame* frame) {
415
418
int32_t id = frame->hd .stream_id ;
416
419
DEBUG_HTTP2 (" Nghttp2Session %s: handling data frame for stream %d\n " ,
417
- TypeName (), id);
420
+ TypeName (type () ), id);
418
421
Nghttp2Stream* stream = this ->FindStream (id);
419
422
// If the stream does not exist, something really bad happened
420
423
CHECK_NE (stream, nullptr );
@@ -430,7 +433,7 @@ inline void Nghttp2Session::HandleHeadersFrame(const nghttp2_frame* frame) {
430
433
int32_t id = (frame->hd .type == NGHTTP2_PUSH_PROMISE) ?
431
434
frame->push_promise .promised_stream_id : frame->hd .stream_id ;
432
435
DEBUG_HTTP2 (" Nghttp2Session %s: handling headers frame for stream %d\n " ,
433
- TypeName (), id);
436
+ TypeName (type () ), id);
434
437
Nghttp2Stream* stream = FindStream (id);
435
438
// If the stream does not exist, something really bad happened
436
439
CHECK_NE (stream, nullptr );
@@ -446,7 +449,7 @@ inline void Nghttp2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
446
449
nghttp2_priority priority_frame = frame->priority ;
447
450
int32_t id = frame->hd .stream_id ;
448
451
DEBUG_HTTP2 (" Nghttp2Session %s: handling priority frame for stream %d\n " ,
449
- TypeName (), id);
452
+ TypeName (type () ), id);
450
453
// Ignore the priority frame if stream ID is <= 0
451
454
// This actually should never happen because nghttp2 should treat this as
452
455
// an error condition that terminates the session.
@@ -459,7 +462,7 @@ inline void Nghttp2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
459
462
// Notifies the JS layer that a GOAWAY frame has been received
460
463
inline void Nghttp2Session::HandleGoawayFrame (const nghttp2_frame* frame) {
461
464
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 () ));
463
466
464
467
OnGoAway (goaway_frame.last_stream_id ,
465
468
goaway_frame.error_code ,
@@ -469,7 +472,7 @@ inline void Nghttp2Session::HandleGoawayFrame(const nghttp2_frame* frame) {
469
472
470
473
// Prompts nghttp2 to flush the queue of pending data frames
471
474
inline void Nghttp2Session::SendPendingData () {
472
- DEBUG_HTTP2 (" Nghttp2Session %s: Sending pending data\n " , TypeName ());
475
+ DEBUG_HTTP2 (" Nghttp2Session %s: Sending pending data\n " , TypeName (type () ));
473
476
// Do not attempt to send data on the socket if the destroying flag has
474
477
// been set. That means everything is shutting down and the socket
475
478
// will not be usable.
@@ -504,7 +507,7 @@ inline int Nghttp2Session::Init(uv_loop_t* loop,
504
507
nghttp2_option* options,
505
508
nghttp2_mem* mem) {
506
509
DEBUG_HTTP2 (" Nghttp2Session %s: initializing session\n " ,
507
- SessionTypeName (type));
510
+ TypeName (type));
508
511
loop_ = loop;
509
512
session_type_ = type;
510
513
destroying_ = false ;
@@ -558,7 +561,7 @@ inline void Nghttp2Session::MarkDestroying() {
558
561
559
562
inline int Nghttp2Session::Free () {
560
563
CHECK (session_ != nullptr );
561
- DEBUG_HTTP2 (" Nghttp2Session %s: freeing session\n " , TypeName ());
564
+ DEBUG_HTTP2 (" Nghttp2Session %s: freeing session\n " , TypeName (type () ));
562
565
// Stop the loop
563
566
uv_prepare_stop (&prep_);
564
567
auto PrepClose = [](uv_handle_t * handle) {
@@ -572,7 +575,7 @@ inline int Nghttp2Session::Free() {
572
575
nghttp2_session_del (session_);
573
576
session_ = nullptr ;
574
577
loop_ = nullptr ;
575
- DEBUG_HTTP2 (" Nghttp2Session %s: session freed\n " , TypeName ());
578
+ DEBUG_HTTP2 (" Nghttp2Session %s: session freed\n " , TypeName (type () ));
576
579
return 1 ;
577
580
}
578
581
0 commit comments