@@ -68,6 +68,7 @@ namespace quic {
6868 V (DESTROYED, destroyed, uint8_t ) \
6969 V (HANDSHAKE_COMPLETED, handshake_completed, uint8_t ) \
7070 V (HANDSHAKE_CONFIRMED, handshake_confirmed, uint8_t ) \
71+ V (STREAM_OPEN_ALLOWED, stream_open_allowed, uint8_t ) \
7172 /* A Session is wrapped if it has been passed out to JS */ \
7273 V (WRAPPED, wrapped, uint8_t ) \
7374 V (LAST_DATAGRAM_ID, last_datagram_id, uint64_t )
@@ -1002,6 +1003,15 @@ bool Session::is_in_draining_period() const {
10021003 return ngtcp2_conn_is_in_draining_period (*this );
10031004}
10041005
1006+ bool Session::wants_session_ticket () const {
1007+ return state_->session_ticket == 1 ;
1008+ }
1009+
1010+ void Session::SetStreamOpenAllowed () {
1011+ // TODO(@jasnell): Might remove this. May not be needed
1012+ state_->stream_open_allowed = 1 ;
1013+ }
1014+
10051015bool Session::can_send_packets () const {
10061016 // We can send packets if we're not in the middle of a ngtcp2 callback,
10071017 // we're not destroyed, we're not in a draining or closing period, and
@@ -1273,7 +1283,7 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) {
12731283 switch (family) {
12741284 case AF_INET: {
12751285 auto ipv4 = preferredAddress->ipv4 ();
1276- if (ipv4 != std:: nullopt ) {
1286+ if (ipv4. has_value () ) {
12771287 if (ipv4->address .empty () || ipv4->port == 0 ) return ;
12781288 SocketAddress::New (AF_INET,
12791289 std::string (ipv4->address ).c_str (),
@@ -1285,7 +1295,7 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) {
12851295 }
12861296 case AF_INET6: {
12871297 auto ipv6 = preferredAddress->ipv6 ();
1288- if (ipv6 != std:: nullopt ) {
1298+ if (ipv6. has_value () ) {
12891299 if (ipv6->address .empty () || ipv6->port == 0 ) return ;
12901300 SocketAddress::New (AF_INET,
12911301 std::string (ipv6->address ).c_str (),
@@ -2133,7 +2143,7 @@ void Session::Initialize(Environment* env, Local<Object> target) {
21332143#undef V
21342144
21352145#define V (name, key, __ ) \
2136- auto IDX_STATE_SESSION_##name = OffsetOf (& Session::State:: key);
2146+ auto IDX_STATE_SESSION_##name = offsetof ( Session::State, key);
21372147 SESSION_STATE (V)
21382148#undef V
21392149
0 commit comments