@@ -71,7 +71,7 @@ namespace quic {
7171 V (STREAM_OPEN_ALLOWED, stream_open_allowed, uint8_t ) \
7272 V (PRIORITY_SUPPORTED, priority_supported, uint8_t ) \
7373 V (WRAPPED, wrapped, uint8_t ) \
74- V (LAST_DATAGRAM_ID, last_datagram_id, uint64_t )
74+ V (LAST_DATAGRAM_ID, last_datagram_id, datagram_id )
7575
7676#define SESSION_STATS (V ) \
7777 V (CREATED_AT, created_at) \
@@ -815,7 +815,7 @@ struct Session::Impl final : public MemoryRetainer {
815815 // Internal ngtcp2 callbacks
816816
817817 static int on_acknowledge_stream_data_offset (ngtcp2_conn* conn,
818- int64_t stream_id,
818+ stream_id stream_id,
819819 uint64_t offset,
820820 uint64_t datalen,
821821 void * user_data,
@@ -835,7 +835,7 @@ struct Session::Impl final : public MemoryRetainer {
835835 }
836836
837837 static int on_acknowledge_datagram (ngtcp2_conn* conn,
838- uint64_t dgram_id,
838+ datagram_id dgram_id,
839839 void * user_data) {
840840 NGTCP2_CALLBACK_SCOPE (session)
841841 session->DatagramStatus (dgram_id, DatagramStatus::ACKNOWLEDGED);
@@ -905,7 +905,7 @@ struct Session::Impl final : public MemoryRetainer {
905905 }
906906
907907 static int on_extend_max_stream_data (ngtcp2_conn* conn,
908- int64_t stream_id,
908+ stream_id stream_id,
909909 uint64_t max_data,
910910 void * user_data,
911911 void * stream_user_data) {
@@ -938,7 +938,7 @@ struct Session::Impl final : public MemoryRetainer {
938938 }
939939
940940 static int on_lost_datagram (ngtcp2_conn* conn,
941- uint64_t dgram_id,
941+ datagram_id dgram_id,
942942 void * user_data) {
943943 NGTCP2_CALLBACK_SCOPE (session)
944944 session->DatagramStatus (dgram_id, DatagramStatus::LOST);
@@ -1022,7 +1022,7 @@ struct Session::Impl final : public MemoryRetainer {
10221022
10231023 static int on_receive_stream_data (ngtcp2_conn* conn,
10241024 uint32_t flags,
1025- int64_t stream_id,
1025+ stream_id stream_id,
10261026 uint64_t offset,
10271027 const uint8_t * data,
10281028 size_t datalen,
@@ -1105,8 +1105,8 @@ struct Session::Impl final : public MemoryRetainer {
11051105
11061106 static int on_stream_close (ngtcp2_conn* conn,
11071107 uint32_t flags,
1108- int64_t stream_id,
1109- uint64_t app_error_code,
1108+ stream_id stream_id,
1109+ error_code app_error_code,
11101110 void * user_data,
11111111 void * stream_user_data) {
11121112 NGTCP2_CALLBACK_SCOPE (session)
@@ -1121,9 +1121,9 @@ struct Session::Impl final : public MemoryRetainer {
11211121 }
11221122
11231123 static int on_stream_reset (ngtcp2_conn* conn,
1124- int64_t stream_id,
1124+ stream_id stream_id,
11251125 uint64_t final_size,
1126- uint64_t app_error_code,
1126+ error_code app_error_code,
11271127 void * user_data,
11281128 void * stream_user_data) {
11291129 NGTCP2_CALLBACK_SCOPE (session)
@@ -1135,8 +1135,8 @@ struct Session::Impl final : public MemoryRetainer {
11351135 }
11361136
11371137 static int on_stream_stop_sending (ngtcp2_conn* conn,
1138- int64_t stream_id,
1139- uint64_t app_error_code,
1138+ stream_id stream_id,
1139+ error_code app_error_code,
11401140 void * user_data,
11411141 void * stream_user_data) {
11421142 NGTCP2_CALLBACK_SCOPE (session)
@@ -1718,7 +1718,7 @@ void Session::Send(const BaseObjectPtr<Packet>& packet,
17181718 Send (packet);
17191719}
17201720
1721- uint64_t Session::SendDatagram (Store&& data) {
1721+ datagram_id Session::SendDatagram (Store&& data) {
17221722 DCHECK (!is_destroyed ());
17231723
17241724 // Sending a datagram is best effort. If we cannot send it for any reason,
@@ -1754,7 +1754,7 @@ uint64_t Session::SendDatagram(Store&& data) {
17541754 ngtcp2_vec vec = data;
17551755 PathStorage path;
17561756 int flags = NGTCP2_WRITE_DATAGRAM_FLAG_MORE;
1757- uint64_t did = impl_->state_ ->last_datagram_id + 1 ;
1757+ datagram_id did = impl_->state_ ->last_datagram_id + 1 ;
17581758
17591759 Debug (this , " Sending %zu-byte datagram %" PRIu64, data.length (), did);
17601760
@@ -1924,15 +1924,15 @@ void Session::UpdatePath(const PathStorage& storage) {
19241924 impl_->remote_address_ );
19251925}
19261926
1927- BaseObjectPtr<Stream> Session::FindStream (int64_t id) const {
1927+ BaseObjectPtr<Stream> Session::FindStream (stream_id id) const {
19281928 if (is_destroyed ()) return {};
19291929 auto it = impl_->streams_ .find (id);
19301930 if (it == std::end (impl_->streams_ )) return {};
19311931 return it->second ;
19321932}
19331933
19341934BaseObjectPtr<Stream> Session::CreateStream (
1935- int64_t id,
1935+ stream_id id,
19361936 CreateStreamOption option,
19371937 std::shared_ptr<DataQueue> data_source) {
19381938 if (!can_create_streams ()) [[unlikely]]
@@ -1965,7 +1965,7 @@ MaybeLocal<Object> Session::OpenStream(Direction direction,
19651965 return {};
19661966 }
19671967
1968- int64_t id = -1 ;
1968+ stream_id id = -1 ;
19691969 auto open = [&] {
19701970 switch (direction) {
19711971 case Direction::BIDIRECTIONAL: {
@@ -2061,7 +2061,7 @@ void Session::AddStream(BaseObjectPtr<Stream> stream,
20612061 }
20622062}
20632063
2064- void Session::RemoveStream (int64_t id) {
2064+ void Session::RemoveStream (stream_id id) {
20652065 DCHECK (!is_destroyed ());
20662066 Debug (this , " Removing stream %" PRIi64 " from session" , id);
20672067 if (!is_in_draining_period () && !is_in_closing_period () &&
@@ -2093,13 +2093,13 @@ void Session::RemoveStream(int64_t id) {
20932093 }
20942094}
20952095
2096- void Session::ResumeStream (int64_t id) {
2096+ void Session::ResumeStream (stream_id id) {
20972097 DCHECK (!is_destroyed ());
20982098 SendPendingDataScope send_scope (this );
20992099 application ().ResumeStream (id);
21002100}
21012101
2102- void Session::ShutdownStream (int64_t id, QuicError error) {
2102+ void Session::ShutdownStream (stream_id id, QuicError error) {
21032103 DCHECK (!is_destroyed ());
21042104 Debug (this , " Shutting down stream %" PRIi64 " with error %s" , id, error);
21052105 SendPendingDataScope send_scope (this );
@@ -2111,7 +2111,7 @@ void Session::ShutdownStream(int64_t id, QuicError error) {
21112111 : application ().GetNoErrorCode ());
21122112}
21132113
2114- void Session::ShutdownStreamWrite (int64_t id, QuicError code) {
2114+ void Session::ShutdownStreamWrite (stream_id id, QuicError code) {
21152115 DCHECK (!is_destroyed ());
21162116 Debug (this , " Shutting down stream %" PRIi64 " write with error %s" , id, code);
21172117 SendPendingDataScope send_scope (this );
@@ -2123,7 +2123,7 @@ void Session::ShutdownStreamWrite(int64_t id, QuicError code) {
21232123 : application ().GetNoErrorCode ());
21242124}
21252125
2126- void Session::StreamDataBlocked (int64_t id) {
2126+ void Session::StreamDataBlocked (stream_id id) {
21272127 DCHECK (!is_destroyed ());
21282128 auto & stats_ = impl_->stats_ ;
21292129 STAT_INCREMENT (Stats, block_count);
@@ -2217,7 +2217,7 @@ void Session::set_priority_supported(bool on) {
22172217 impl_->state_ ->priority_supported = on ? 1 : 0 ;
22182218}
22192219
2220- void Session::ExtendStreamOffset (int64_t id, size_t amount) {
2220+ void Session::ExtendStreamOffset (stream_id id, size_t amount) {
22212221 DCHECK (!is_destroyed ());
22222222 Debug (this , " Extending stream %" PRIi64 " offset by %zu bytes" , id, amount);
22232223 ngtcp2_conn_extend_max_stream_offset (*this , id, amount);
@@ -2341,7 +2341,8 @@ void Session::UpdateTimer() {
23412341 impl_->timer_ .Update (timeout == 0 ? 1 : timeout);
23422342}
23432343
2344- void Session::DatagramStatus (uint64_t datagramId, quic::DatagramStatus status) {
2344+ void Session::DatagramStatus (datagram_id datagramId,
2345+ quic::DatagramStatus status) {
23452346 DCHECK (!is_destroyed ());
23462347 auto & stats_ = impl_->stats_ ;
23472348 switch (status) {
@@ -2478,7 +2479,7 @@ void Session::ProcessPendingBidiStreams() {
24782479 // It shouldn't be possible to get here if can_create_streams() is false.
24792480 DCHECK (can_create_streams ());
24802481
2481- int64_t id;
2482+ stream_id id;
24822483
24832484 while (!impl_->pending_bidi_stream_queue_ .IsEmpty ()) {
24842485 if (ngtcp2_conn_get_streams_bidi_left (*this ) == 0 ) {
@@ -2511,7 +2512,7 @@ void Session::ProcessPendingUniStreams() {
25112512 // It shouldn't be possible to get here if can_create_streams() is false.
25122513 DCHECK (can_create_streams ());
25132514
2514- int64_t id;
2515+ stream_id id;
25152516
25162517 while (!impl_->pending_uni_stream_queue_ .IsEmpty ()) {
25172518 if (ngtcp2_conn_get_streams_uni_left (*this ) == 0 ) {
@@ -2583,7 +2584,7 @@ void Session::EmitDatagram(Store&& datagram, DatagramReceivedFlags flag) {
25832584 argv);
25842585}
25852586
2586- void Session::EmitDatagramStatus (uint64_t id, quic::DatagramStatus status) {
2587+ void Session::EmitDatagramStatus (datagram_id id, quic::DatagramStatus status) {
25872588 DCHECK (!is_destroyed ());
25882589
25892590 if (!env ()->can_call_into_js ()) return ;
0 commit comments