| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d7317f4 commit 7cda430
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -354,6 +354,7 @@ | |||
| 354 | 354 | 'src/quic/tlscontext.cc', | |
| 355 | 355 | 'src/quic/transportparams.cc', | |
| 356 | 356 | 'src/quic/quic.cc', | |
| 357 | + 'src/quic/arena.h', | ||
| 357 | 358 | 'src/quic/bindingdata.h', | |
| 358 | 359 | 'src/quic/cid.h', | |
| 359 | 360 | 'src/quic/data.h', | |
@@ -440,6 +441,7 @@ | |||
| 440 | 441 | 'test/cctest/test_node_crypto_env.cc', | |
| 441 | 442 | ], | |
| 442 | 443 | 'node_cctest_quic_sources': [ | |
| 444 | + 'test/cctest/test_quic_arena.cc', | ||
| 443 | 445 | 'test/cctest/test_quic_cid.cc', | |
| 444 | 446 | 'test/cctest/test_quic_error.cc', | |
| 445 | 447 | 'test/cctest/test_quic_preferredaddress.cc', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,6 @@ namespace node { | |||
| 63 | 63 | V(QUERYWRAP) \ | |
| 64 | 64 | V(QUIC_ENDPOINT) \ | |
| 65 | 65 | V(QUIC_LOGSTREAM) \ | |
| 66 | - V(QUIC_PACKET) \ | ||
| 67 | 66 | V(QUIC_SESSION) \ | |
| 68 | 67 | V(QUIC_STREAM) \ | |
| 69 | 68 | V(QUIC_UDP) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,6 @@ | |||
| 1 | 1 | #if HAVE_OPENSSL && HAVE_QUIC | |
| 2 | 2 | #include "guard.h" | |
| 3 | 3 | #ifndef OPENSSL_NO_QUIC | |
| 4 | - #include "application.h" | ||
| 5 | 4 | #include <async_wrap-inl.h> | |
| 6 | 5 | #include <debug_utils-inl.h> | |
| 7 | 6 | #include <nghttp3/nghttp3.h> | |
@@ -10,6 +9,7 @@ | |||
| 10 | 9 | #include <node_sockaddr-inl.h> | |
| 11 | 10 | #include <uv.h> | |
| 12 | 11 | #include <v8.h> | |
| 12 | + #include "application.h" | ||
| 13 | 13 | #include "defs.h" | |
| 14 | 14 | #include "endpoint.h" | |
| 15 | 15 | #include "http3.h" | |
@@ -207,12 +207,9 @@ StreamPriority Session::Application::GetStreamPriority(const Stream& stream) { | |||
| 207 | 207 | return StreamPriority::DEFAULT; | |
| 208 | 208 | } | |
| 209 | 209 | ||
| 210 | - BaseObjectPtr<Packet> Session::Application::CreateStreamDataPacket() { | ||
| 211 | - return Packet::Create(env(), | ||
| 212 | - session_->endpoint(), | ||
| 213 | - session_->remote_address(), | ||
| 214 | - session_->max_packet_size(), | ||
| 215 | - "stream data"); | ||
| 210 | + Packet::Ptr Session::Application::CreateStreamDataPacket() { | ||
| 211 | + return session_->endpoint().CreatePacket( | ||
| 212 | + session_->remote_address(), session_->max_packet_size(), "stream data"); | ||
| 216 | 213 | } | |
| 217 | 214 | ||
| 218 | 215 | void Session::Application::StreamClose(Stream* stream, QuicError&& error) { | |
@@ -264,7 +261,7 @@ void Session::Application::SendPendingData() { | |||
| 264 | 261 | // The number of packets that have been sent in this call to SendPendingData. | |
| 265 | 262 | size_t packet_send_count = 0; | |
| 266 | 263 | ||
| 267 | - BaseObjectPtr<Packet> packet; | ||
| 264 | + Packet::Ptr packet; | ||
| 268 | 265 | uint8_t* pos = nullptr; | |
| 269 | 266 | uint8_t* begin = nullptr; | |
| 270 | 267 | ||
@@ -273,7 +270,7 @@ void Session::Application::SendPendingData() { | |||
| 273 | 270 | packet = CreateStreamDataPacket(); | |
| 274 | 271 | if (!packet) [[unlikely]] | |
| 275 | 272 | return false; | |
| 276 | - pos = begin = ngtcp2_vec(*packet).base; | ||
| 273 | + pos = begin = packet->data(); | ||
| 277 | 274 | } | |
| 278 | 275 | DCHECK(packet); | |
| 279 | 276 | DCHECK_NOT_NULL(pos); | |
@@ -299,7 +296,6 @@ void Session::Application::SendPendingData() { | |||
| 299 | 296 | // The stream_data is the next block of data from the application stream. | |
| 300 | 297 | if (GetStreamData(&stream_data) < 0) { | |
| 301 | 298 | Debug(session_, "Application failed to get stream data"); | |
| 302 | - packet->CancelPacket(); | ||
| 303 | 299 | session_->SetLastError(QuicError::ForNgtcp2Error(NGTCP2_ERR_INTERNAL)); | |
| 304 | 300 | closed = true; | |
| 305 | 301 | return session_->Close(CloseMethod::SILENT); | |
@@ -367,7 +363,6 @@ void Session::Application::SendPendingData() { | |||
| 367 | 363 | if (ndatalen >= 0 && !StreamCommit(&stream_data, ndatalen)) { | |
| 368 | 364 | Debug(session_, | |
| 369 | 365 | "Failed to commit stream data while writing packets"); | |
| 370 | - packet->CancelPacket(); | ||
| 371 | 366 | session_->SetLastError( | |
| 372 | 367 | QuicError::ForNgtcp2Error(NGTCP2_ERR_INTERNAL)); | |
| 373 | 368 | closed = true; | |
@@ -380,7 +375,6 @@ void Session::Application::SendPendingData() { | |||
| 380 | 375 | // ngtcp2 callback failed for some reason. This would be a | |
| 381 | 376 | // bug in our code. | |
| 382 | 377 | Debug(session_, "Internal failure with ngtcp2 callback"); | |
| 383 | - packet->CancelPacket(); | ||
| 384 | 378 | session_->SetLastError( | |
| 385 | 379 | QuicError::ForNgtcp2Error(NGTCP2_ERR_INTERNAL)); | |
| 386 | 380 | closed = true; | |
@@ -393,12 +387,10 @@ void Session::Application::SendPendingData() { | |||
| 393 | 387 | Debug(session_, | |
| 394 | 388 | "Application encountered error while writing packet: %s", | |
| 395 | 389 | ngtcp2_strerror(nwrite)); | |
| 396 | - packet->CancelPacket(); | ||
| 397 | 390 | session_->SetLastError(QuicError::ForNgtcp2Error(nwrite)); | |
| 398 | 391 | closed = true; | |
| 399 | 392 | return session_->Close(CloseMethod::SILENT); | |
| 400 | 393 | } else if (ndatalen >= 0 && !StreamCommit(&stream_data, ndatalen)) { | |
| 401 | - packet->CancelPacket(); | ||
| 402 | 394 | session_->SetLastError(QuicError::ForNgtcp2Error(NGTCP2_ERR_INTERNAL)); | |
| 403 | 395 | closed = true; | |
| 404 | 396 | return session_->Close(CloseMethod::SILENT); | |
@@ -416,10 +408,9 @@ void Session::Application::SendPendingData() { | |||
| 416 | 408 | if (datalen) { | |
| 417 | 409 | Debug(session_, "Sending packet with %zu bytes", datalen); | |
| 418 | 410 | packet->Truncate(datalen); | |
| 419 | - session_->Send(packet, path); | ||
| 420 | - } else { | ||
| 421 | - packet->CancelPacket(); | ||
| 411 | + session_->Send(std::move(packet), path); | ||
| 422 | 412 | } | |
| 413 | + // If no data, Ptr destructor releases the packet. | ||
| 423 | 414 | ||
| 424 | 415 | return; | |
| 425 | 416 | } | |
@@ -429,15 +420,15 @@ void Session::Application::SendPendingData() { | |||
| 429 | 420 | size_t datalen = pos - begin; | |
| 430 | 421 | Debug(session_, "Sending packet with %zu bytes", datalen); | |
| 431 | 422 | packet->Truncate(datalen); | |
| 432 | - session_->Send(packet, path); | ||
| 423 | + session_->Send(std::move(packet), path); | ||
| 433 | 424 | ||
| 434 | 425 | // If we have sent the maximum number of packets, we're done. | |
| 435 | 426 | if (++packet_send_count == max_packet_count) { | |
| 436 | 427 | return; | |
| 437 | 428 | } | |
| 438 | 429 | ||
| 439 | 430 | // Prepare to loop back around to prepare a new packet. | |
| 440 | - packet.reset(); | ||
| 431 | + // packet is already empty from the std::move above. | ||
| 441 | 432 | pos = begin = nullptr; | |
| 442 | 433 | } | |
| 443 | 434 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -132,7 +132,7 @@ class Session::Application : public MemoryRetainer { | |||
| 132 | 132 | } | |
| 133 | 133 | ||
| 134 | 134 | private: | |
| 135 | - BaseObjectPtr<Packet> CreateStreamDataPacket(); | ||
| 135 | + Packet::Ptr CreateStreamDataPacket(); | ||
| 136 | 136 | ||
| 137 | 137 | // Write the given stream_data into the buffer. | |
| 138 | 138 | ssize_t WriteVStream(PathStorage* path, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments