@@ -71,9 +71,9 @@ const {
7171 IDX_STATE_SESSION_HANDSHAKE_CONFIRMED ,
7272 IDX_STATE_SESSION_STREAM_OPEN_ALLOWED ,
7373 IDX_STATE_SESSION_PRIORITY_SUPPORTED ,
74- IDX_STATE_SESSION_HEADERS_SUPPORTED ,
7574 IDX_STATE_SESSION_WRAPPED ,
76- IDX_STATE_SESSION_APPLICATION_TYPE ,
75+ IDX_STATE_SESSION_IS_SERVER ,
76+ IDX_STATE_SESSION_HAS_APPLICATION ,
7777 IDX_STATE_SESSION_NO_ERROR_CODE ,
7878 IDX_STATE_SESSION_INTERNAL_ERROR_CODE ,
7979 IDX_STATE_SESSION_MAX_DATAGRAM_SIZE ,
@@ -117,9 +117,9 @@ assert(IDX_STATE_SESSION_HANDSHAKE_COMPLETED !== undefined);
117117assert ( IDX_STATE_SESSION_HANDSHAKE_CONFIRMED !== undefined ) ;
118118assert ( IDX_STATE_SESSION_STREAM_OPEN_ALLOWED !== undefined ) ;
119119assert ( IDX_STATE_SESSION_PRIORITY_SUPPORTED !== undefined ) ;
120- assert ( IDX_STATE_SESSION_HEADERS_SUPPORTED !== undefined ) ;
120+ assert ( IDX_STATE_SESSION_HAS_APPLICATION !== undefined ) ;
121+ assert ( IDX_STATE_SESSION_IS_SERVER !== undefined ) ;
121122assert ( IDX_STATE_SESSION_WRAPPED !== undefined ) ;
122- assert ( IDX_STATE_SESSION_APPLICATION_TYPE !== undefined ) ;
123123assert ( IDX_STATE_SESSION_NO_ERROR_CODE !== undefined ) ;
124124assert ( IDX_STATE_SESSION_INTERNAL_ERROR_CODE !== undefined ) ;
125125assert ( IDX_STATE_SESSION_MAX_DATAGRAM_SIZE !== undefined ) ;
@@ -349,7 +349,6 @@ class QuicSessionState {
349349 static #LISTENER_SESSION_TICKET = 1 << 3 ;
350350 static #LISTENER_NEW_TOKEN = 1 << 4 ;
351351 static #LISTENER_ORIGIN = 1 << 5 ;
352- static #LISTENER_APPLICATION = 1 << 6 ;
353352
354353 #getListenerFlag( flag ) {
355354 const handle = this . #handle;
@@ -368,13 +367,6 @@ class QuicSessionState {
368367 val ? ( current | flag ) : ( current & ~ flag ) , kIsLittleEndian ) ;
369368 }
370369
371- /** @type {boolean } */
372- get hasApplicationListener ( ) {
373- return this . #getListenerFlag( QuicSessionState . #LISTENER_APPLICATION) ;
374- }
375- set hasApplicationListener ( val ) {
376- this . #setListenerFlag( QuicSessionState . #LISTENER_APPLICATION, val ) ;
377- }
378370
379371 /** @type {boolean } */
380372 get hasPathValidationListener ( ) {
@@ -481,14 +473,14 @@ class QuicSessionState {
481473 }
482474
483475 /**
484- * Whether the negotiated application protocol supports headers.
485- * Returns 0 (unknown), 1 (supported), or 2 (not supported) .
486- * @type {number }
476+ * Whether a protocol application (vs the native raw-stream path) is
477+ * installed on the session .
478+ * @type {boolean }
487479 */
488- get headersSupported ( ) {
480+ get hasApplication ( ) {
489481 const handle = this . #handle;
490482 if ( handle === undefined ) return undefined ;
491- return DataViewPrototypeGetUint8 ( handle , this . #offset + IDX_STATE_SESSION_HEADERS_SUPPORTED ) ;
483+ return DataViewPrototypeGetUint8 ( handle , this . #offset + IDX_STATE_SESSION_HAS_APPLICATION ) !== 0 ;
492484 }
493485
494486 /** @type {boolean } */
@@ -498,17 +490,21 @@ class QuicSessionState {
498490 return DataViewPrototypeGetUint8 ( handle , this . #offset + IDX_STATE_SESSION_WRAPPED ) !== 0 ;
499491 }
500492
501- /** @type {number } */
502- get applicationType ( ) {
493+ /**
494+ * True for server (accepted) sessions, false for client (initiated)
495+ * sessions. Fixed for the session's lifetime.
496+ * @type {boolean }
497+ */
498+ get isServer ( ) {
503499 const handle = this . #handle;
504500 if ( handle === undefined ) return undefined ;
505- return DataViewPrototypeGetUint8 ( handle , this . #offset + IDX_STATE_SESSION_APPLICATION_TYPE ) ;
501+ return DataViewPrototypeGetUint8 ( handle , this . #offset + IDX_STATE_SESSION_IS_SERVER ) !== 0 ;
506502 }
507503
508504 /**
509- * The negotiated application protocol 's "no error" code, populated
510- * by the C++ layer when the application is selected during ALPN
511- * negotiation. For raw QUIC this is `0n`; for HTTP/3 this is
505+ * The installed application's "no error" code, populated
506+ * by the C++ layer when the application is installed.
507+ * For raw QUIC this is `0n`; for HTTP/3 this is
512508 * `0x100n` (`H3_NO_ERROR`).
513509 * @type {bigint }
514510 */
@@ -520,7 +516,7 @@ class QuicSessionState {
520516 }
521517
522518 /**
523- * The negotiated application protocol 's "internal error" code,
519+ * The installed application's "internal error" code,
524520 * populated by the C++ layer when the application is selected
525521 * during ALPN negotiation. Used as the wire code for `RESET_STREAM`
526522 * frames when a stream is aborted without a more specific code.
@@ -589,9 +585,9 @@ class QuicSessionState {
589585 isHandshakeConfirmed,
590586 isStreamOpenAllowed,
591587 isPrioritySupported,
592- headersSupported ,
588+ hasApplication ,
593589 isWrapped,
594- applicationType ,
590+ isServer ,
595591 noErrorCode,
596592 internalErrorCode,
597593 maxDatagramSize,
@@ -614,9 +610,9 @@ class QuicSessionState {
614610 isHandshakeConfirmed,
615611 isStreamOpenAllowed,
616612 isPrioritySupported,
617- headersSupported ,
613+ hasApplication ,
618614 isWrapped,
619- applicationType ,
615+ isServer ,
620616 noErrorCode : `${ noErrorCode } ` ,
621617 internalErrorCode : `${ internalErrorCode } ` ,
622618 maxDatagramSize : `${ maxDatagramSize } ` ,
@@ -655,9 +651,9 @@ class QuicSessionState {
655651 isHandshakeConfirmed,
656652 isStreamOpenAllowed,
657653 isPrioritySupported,
658- headersSupported ,
654+ hasApplication ,
659655 isWrapped,
660- applicationType ,
656+ isServer ,
661657 noErrorCode,
662658 internalErrorCode,
663659 maxDatagramSize,
@@ -680,9 +676,9 @@ class QuicSessionState {
680676 isHandshakeConfirmed,
681677 isStreamOpenAllowed,
682678 isPrioritySupported,
683- headersSupported ,
679+ hasApplication ,
684680 isWrapped,
685- applicationType ,
681+ isServer ,
686682 noErrorCode,
687683 internalErrorCode,
688684 maxDatagramSize,
0 commit comments