| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -411,8 +411,7 @@ void Blob::Reader::Pull(const FunctionCallbackInfo<Value>& args) { | |||
| 411 | 411 | std::move(next), node::bob::OPTIONS_END, nullptr, 0)); | |
| 412 | 412 | } | |
| 413 | 413 | ||
| 414 | - void Blob::Reader::SetWakeup( | ||
| 415 | - const FunctionCallbackInfo<Value>& args) { | ||
| 414 | + void Blob::Reader::SetWakeup(const FunctionCallbackInfo<Value>& args) { | ||
| 416 | 415 | Blob::Reader* reader; | |
| 417 | 416 | ASSIGN_OR_RETURN_UNWRAP(&reader, args.This()); | |
| 418 | 417 | CHECK(args[0]->IsFunction()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -452,7 +452,7 @@ ssize_t Session::Application::WriteVStream(PathStorage* path, | |||
| 452 | 452 | if (stream_data.fin) flags |= NGTCP2_WRITE_STREAM_FLAG_FIN; | |
| 453 | 453 | return ngtcp2_conn_writev_stream(*session_, | |
| 454 | 454 | &path->path, | |
| 455 | - // TODO(@jasnell): ECN blocked on libuv | ||
| 455 | + // TODO(@jasnell): ECN blocked on libuv | ||
| 456 | 456 | nullptr, | |
| 457 | 457 | dest, | |
| 458 | 458 | max_packet_size, | |
@@ -583,7 +583,6 @@ class DefaultApplication final : public Session::Application { | |||
| 583 | 583 | ||
| 584 | 584 | void ResumeStream(int64_t id) override { ScheduleStream(id); } | |
| 585 | 585 | ||
| 586 | - | ||
| 587 | 586 | void BlockStream(int64_t id) override { | |
| 588 | 587 | if (auto stream = session().FindStream(id)) [[likely]] { | |
| 589 | 588 | stream->EmitBlocked(); | |
@@ -608,7 +607,6 @@ class DefaultApplication final : public Session::Application { | |||
| 608 | 607 | } | |
| 609 | 608 | } | |
| 610 | 609 | ||
| 611 | - | ||
| 612 | 610 | Stream::Queue stream_queue_; | |
| 613 | 611 | }; | |
| 614 | 612 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,9 +155,9 @@ struct Session::Application::StreamData final { | |||
| 155 | 155 | BaseObjectPtr<Stream> stream; | |
| 156 | 156 | ||
| 157 | 157 | static_assert(sizeof(ngtcp2_vec) == sizeof(nghttp3_vec) && | |
| 158 | - alignof(ngtcp2_vec) == alignof(nghttp3_vec) && | ||
| 159 | - offsetof(ngtcp2_vec, base) == offsetof(nghttp3_vec, base) && | ||
| 160 | - offsetof(ngtcp2_vec, len) == offsetof(nghttp3_vec, len), | ||
| 158 | + alignof(ngtcp2_vec) == alignof(nghttp3_vec) && | ||
| 159 | + offsetof(ngtcp2_vec, base) == offsetof(nghttp3_vec, base) && | ||
| 160 | + offsetof(ngtcp2_vec, len) == offsetof(nghttp3_vec, len), | ||
| 161 | 161 | "ngtcp2_vec and nghttp3_vec must have identical layout"); | |
| 162 | 162 | inline operator nghttp3_vec*() { | |
| 163 | 163 | return reinterpret_cast<nghttp3_vec*>(data); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,7 @@ class Packet; | |||
| 43 | 43 | V(session_datagram_status, SessionDatagramStatus) \ | |
| 44 | 44 | V(session_handshake, SessionHandshake) \ | |
| 45 | 45 | V(session_new, SessionNew) \ | |
| 46 | - V(session_new_token, SessionNewToken) \ | ||
| 46 | + V(session_new_token, SessionNewToken) \ | ||
| 47 | 47 | V(session_path_validation, SessionPathValidation) \ | |
| 48 | 48 | V(session_ticket, SessionTicket) \ | |
| 49 | 49 | V(session_version_negotiation, SessionVersionNegotiation) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -324,8 +324,7 @@ class Endpoint::UDP::Impl final : public HandleWrap { | |||
| 324 | 324 | DCHECK_NOT_NULL(impl->endpoint_); | |
| 325 | 325 | ||
| 326 | 326 | auto release_buf = [&]() { | |
| 327 | - if (buf->base != nullptr) | ||
| 328 | - impl->env()->release_managed_buffer(*buf); | ||
| 327 | + if (buf->base != nullptr) impl->env()->release_managed_buffer(*buf); | ||
| 329 | 328 | }; | |
| 330 | 329 | ||
| 331 | 330 | // Nothing to do in these cases. Specifically, if the nread | |
@@ -343,9 +342,8 @@ class Endpoint::UDP::Impl final : public HandleWrap { | |||
| 343 | 342 | return; | |
| 344 | 343 | } | |
| 345 | 344 | ||
| 346 | - impl->endpoint_->Receive( | ||
| 347 | - uv_buf_init(buf->base, static_cast<size_t>(nread)), | ||
| 348 | - SocketAddress(addr)); | ||
| 345 | + impl->endpoint_->Receive(uv_buf_init(buf->base, static_cast<size_t>(nread)), | ||
| 346 | + SocketAddress(addr)); | ||
| 349 | 347 | } | |
| 350 | 348 | ||
| 351 | 349 | uv_udp_t handle_; | |
@@ -999,7 +997,6 @@ void Endpoint::Destroy(CloseContext context, int status) { | |||
| 999 | 997 | this, "Destroying endpoint due to \"%s\" with status %d", ctx, status); | |
| 1000 | 998 | } | |
| 1001 | 999 | ||
| 1002 | - | ||
| 1003 | 1000 | state_->listening = 0; | |
| 1004 | 1001 | ||
| 1005 | 1002 | close_context_ = context; | |
@@ -1365,9 +1362,8 @@ void Endpoint::Receive(const uv_buf_t& buf, | |||
| 1365 | 1362 | // trusted networks), we skip the Retry and allow 0-RTT to | |
| 1366 | 1363 | // proceed without additional validation. | |
| 1367 | 1364 | if (options_.validate_address) { | |
| 1368 | - Debug(this, | ||
| 1369 | - "Sending retry to %s due to 0RTT packet", | ||
| 1370 | - remote_address); | ||
| 1365 | + Debug( | ||
| 1366 | + this, "Sending retry to %s due to 0RTT packet", remote_address); | ||
| 1371 | 1367 | SendRetry(PathDescriptor{ | |
| 1372 | 1368 | version, | |
| 1373 | 1369 | dcid, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -311,7 +311,6 @@ class Endpoint final : public AsyncWrap, public Packet::Listener { | |||
| 311 | 311 | // be prevented. | |
| 312 | 312 | void CloseGracefully(); | |
| 313 | 313 | ||
| 314 | - | ||
| 315 | 314 | void PacketDone(int status) override; | |
| 316 | 315 | ||
| 317 | 316 | void EmitNewSession(const BaseObjectPtr<Session>& session); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -455,8 +455,8 @@ class Http3ApplicationImpl final : public Session::Application { | |||
| 455 | 455 | } | |
| 456 | 456 | ||
| 457 | 457 | void SetStreamPriority(const Stream& stream, | |
| 458 | - StreamPriority priority, | ||
| 459 | - StreamPriorityFlags flags) override { | ||
| 458 | + StreamPriority priority, | ||
| 459 | + StreamPriorityFlags flags) override { | ||
| 460 | 460 | nghttp3_pri pri; | |
| 461 | 461 | pri.inc = (flags == StreamPriorityFlags::NON_INCREMENTAL) ? 0 : 1; | |
| 462 | 462 | switch (priority) { | |
@@ -471,8 +471,7 @@ class Http3ApplicationImpl final : public Session::Application { | |||
| 471 | 471 | break; | |
| 472 | 472 | } | |
| 473 | 473 | if (session().is_server()) { | |
| 474 | - nghttp3_conn_set_server_stream_priority( | ||
| 475 | - *this, stream.id(), &pri); | ||
| 474 | + nghttp3_conn_set_server_stream_priority(*this, stream.id(), &pri); | ||
| 476 | 475 | } | |
| 477 | 476 | // Client-side priority is set at request submission time via | |
| 478 | 477 | // nghttp3_conn_submit_request and is not typically changed | |
@@ -536,12 +535,10 @@ class Http3ApplicationImpl final : public Session::Application { | |||
| 536 | 535 | nghttp3_err_infer_quic_app_error_code(err))); | |
| 537 | 536 | return false; | |
| 538 | 537 | } | |
| 539 | - if (data->stream) | ||
| 540 | - data->stream->Commit(datalen, data->fin); | ||
| 538 | + if (data->stream) data->stream->Commit(datalen, data->fin); | ||
| 541 | 539 | return true; | |
| 542 | 540 | } | |
| 543 | 541 | ||
| 544 | - | ||
| 545 | 542 | SET_NO_MEMORY_INFO() | |
| 546 | 543 | SET_MEMORY_INFO_NAME(Http3ApplicationImpl) | |
| 547 | 544 | SET_SELF_SIZE(Http3ApplicationImpl) | |
@@ -724,9 +721,7 @@ class Http3ApplicationImpl final : public Session::Application { | |||
| 724 | 721 | // | |
| 725 | 722 | // This can be called multiple times with a decreasing id as the | |
| 726 | 723 | // peer progressively reduces the set of streams it will process. | |
| 727 | - Debug(&session(), | ||
| 728 | - "HTTP/3 received GOAWAY (id=%" PRIi64 ")", | ||
| 729 | - id); | ||
| 724 | + Debug(&session(), "HTTP/3 received GOAWAY (id=%" PRIi64 ")", id); | ||
| 730 | 725 | session().Close(Session::CloseMethod::GRACEFUL); | |
| 731 | 726 | } | |
| 732 | 727 | ||
@@ -799,42 +794,38 @@ class Http3ApplicationImpl final : public Session::Application { | |||
| 799 | 794 | return 0; | |
| 800 | 795 | } | |
| 801 | 796 | ||
| 802 | - size_t max_count = std::min(veccnt, | ||
| 803 | - static_cast<size_t>(kMaxVectorCount)); | ||
| 797 | + size_t max_count = std::min(veccnt, static_cast<size_t>(kMaxVectorCount)); | ||
| 804 | 798 | nghttp3_ssize result = 0; | |
| 805 | 799 | ||
| 806 | - auto next = [&](int status, | ||
| 807 | - const ngtcp2_vec* data, | ||
| 808 | - size_t count, | ||
| 809 | - bob::Done done) { | ||
| 810 | - switch (status) { | ||
| 811 | - case bob::Status::STATUS_BLOCK: | ||
| 812 | - case bob::Status::STATUS_WAIT: | ||
| 813 | - result = NGHTTP3_ERR_WOULDBLOCK; | ||
| 814 | - return; | ||
| 815 | - case bob::Status::STATUS_EOS: | ||
| 816 | - *pflags |= NGHTTP3_DATA_FLAG_EOF; | ||
| 817 | - break; | ||
| 818 | - } | ||
| 819 | - count = std::min(count, max_count); | ||
| 820 | - for (size_t n = 0; n < count; n++) { | ||
| 821 | - vec[n].base = data[n].base; | ||
| 822 | - vec[n].len = data[n].len; | ||
| 823 | - } | ||
| 824 | - result = static_cast<nghttp3_ssize>(count); | ||
| 825 | - }; | ||
| 800 | + auto next = | ||
| 801 | + [&](int status, const ngtcp2_vec* data, size_t count, bob::Done done) { | ||
| 802 | + switch (status) { | ||
| 803 | + case bob::Status::STATUS_BLOCK: | ||
| 804 | + case bob::Status::STATUS_WAIT: | ||
| 805 | + result = NGHTTP3_ERR_WOULDBLOCK; | ||
| 806 | + return; | ||
| 807 | + case bob::Status::STATUS_EOS: | ||
| 808 | + *pflags |= NGHTTP3_DATA_FLAG_EOF; | ||
| 809 | + break; | ||
| 810 | + } | ||
| 811 | + count = std::min(count, max_count); | ||
| 812 | + for (size_t n = 0; n < count; n++) { | ||
| 813 | + vec[n].base = data[n].base; | ||
| 814 | + vec[n].len = data[n].len; | ||
| 815 | + } | ||
| 816 | + result = static_cast<nghttp3_ssize>(count); | ||
| 817 | + }; | ||
| 826 | 818 | ||
| 827 | 819 | ngtcp2_vec data[kMaxVectorCount]; | |
| 828 | 820 | stream->Pull(std::move(next), | |
| 829 | - bob::Options::OPTIONS_SYNC, | ||
| 830 | - data, | ||
| 831 | - max_count, | ||
| 832 | - max_count); | ||
| 821 | + bob::Options::OPTIONS_SYNC, | ||
| 822 | + data, | ||
| 823 | + max_count, | ||
| 824 | + max_count); | ||
| 833 | 825 | ||
| 834 | 826 | return result; | |
| 835 | 827 | } | |
| 836 | 828 | ||
| 837 | - | ||
| 838 | 829 | static int on_acked_stream_data(nghttp3_conn* conn, | |
| 839 | 830 | int64_t stream_id, | |
| 840 | 831 | uint64_t datalen, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,14 +30,17 @@ std::optional<const PreferredAddress::AddressInfo> get_address_info( | |||
| 30 | 30 | if constexpr (FAMILY == AF_INET) { | |
| 31 | 31 | if (!paddr.ipv4_present) return std::nullopt; | |
| 32 | 32 | address.port = paddr.ipv4.sin_port; | |
| 33 | - if (uv_inet_ntop(FAMILY, &paddr.ipv4.sin_addr, | ||
| 34 | - address.host, sizeof(address.host)) != 0) | ||
| 33 | + if (uv_inet_ntop( | ||
| 34 | + FAMILY, &paddr.ipv4.sin_addr, address.host, sizeof(address.host)) != | ||
| 35 | + 0) | ||
| 35 | 36 | return std::nullopt; | |
| 36 | 37 | } else { | |
| 37 | 38 | if (!paddr.ipv6_present) return std::nullopt; | |
| 38 | 39 | address.port = paddr.ipv6.sin6_port; | |
| 39 | - if (uv_inet_ntop(FAMILY, &paddr.ipv6.sin6_addr, | ||
| 40 | - address.host, sizeof(address.host)) != 0) | ||
| 40 | + if (uv_inet_ntop(FAMILY, | ||
| 41 | + &paddr.ipv6.sin6_addr, | ||
| 42 | + address.host, | ||
| 43 | + sizeof(address.host)) != 0) | ||
| 41 | 44 | return std::nullopt; | |
| 42 | 45 | } | |
| 43 | 46 | return address; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -475,8 +475,7 @@ Maybe<Session::Options> Session::Options::From(Environment* env, | |||
| 475 | 475 | ||
| 476 | 476 | // Parse the optional NEW_TOKEN for address validation on reconnection. | |
| 477 | 477 | Local<Value> token_val; | |
| 478 | - if (params->Get(env->context(), state.token_string()) | ||
| 479 | - .ToLocal(&token_val) && | ||
| 478 | + if (params->Get(env->context(), state.token_string()).ToLocal(&token_val) && | ||
| 480 | 479 | token_val->IsArrayBufferView()) { | |
| 481 | 480 | Store token_store; | |
| 482 | 481 | if (Store::From(token_val.As<ArrayBufferView>()).To(&token_store)) { | |
@@ -897,9 +896,8 @@ struct Session::Impl final : public MemoryRetainer { | |||
| 897 | 896 | uint64_t max_streams, | |
| 898 | 897 | void* user_data) { | |
| 899 | 898 | NGTCP2_CALLBACK_SCOPE(session) | |
| 900 | - Debug(session, | ||
| 901 | - "Max remote bidi streams increased to %" PRIu64, | ||
| 902 | - max_streams); | ||
| 899 | + Debug( | ||
| 900 | + session, "Max remote bidi streams increased to %" PRIu64, max_streams); | ||
| 903 | 901 | return NGTCP2_SUCCESS; | |
| 904 | 902 | } | |
| 905 | 903 | ||
@@ -1630,11 +1628,14 @@ bool Session::Receive(Store&& store, | |||
| 1630 | 1628 | // ngtcp2_conn_read_pkt here, we will need to double check that the | |
| 1631 | 1629 | // session is not destroyed before we try doing anything with it | |
| 1632 | 1630 | // (like updating stats, sending pending data, etc). | |
| 1633 | - int err = ngtcp2_conn_read_pkt( | ||
| 1634 | - *this, &path, | ||
| 1635 | - // TODO(@jasnell): ECN pkt_info blocked on libuv | ||
| 1636 | - nullptr, | ||
| 1637 | - vec.base, vec.len, uv_hrtime()); | ||
| 1631 | + int err = | ||
| 1632 | + ngtcp2_conn_read_pkt(*this, | ||
| 1633 | + &path, | ||
| 1634 | + // TODO(@jasnell): ECN pkt_info blocked on libuv | ||
| 1635 | + nullptr, | ||
| 1636 | + vec.base, | ||
| 1637 | + vec.len, | ||
| 1638 | + uv_hrtime()); | ||
| 1638 | 1639 | ||
| 1639 | 1640 | switch (err) { | |
| 1640 | 1641 | case 0: { | |
@@ -2477,10 +2478,8 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) { | |||
| 2477 | 2478 | auto ipv4 = preferredAddress->ipv4(); | |
| 2478 | 2479 | if (ipv4.has_value()) { | |
| 2479 | 2480 | if (ipv4->host[0] == '\0' || ipv4->port == 0) return; | |
| 2480 | - CHECK(SocketAddress::New(AF_INET, | ||
| 2481 | - ipv4->host, | ||
| 2482 | - ipv4->port, | ||
| 2483 | - &impl_->remote_address_)); | ||
| 2481 | + CHECK(SocketAddress::New( | ||
| 2482 | + AF_INET, ipv4->host, ipv4->port, &impl_->remote_address_)); | ||
| 2484 | 2483 | preferredAddress->Use(ipv4.value()); | |
| 2485 | 2484 | } | |
| 2486 | 2485 | break; | |
@@ -2490,10 +2489,8 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) { | |||
| 2490 | 2489 | auto ipv6 = preferredAddress->ipv6(); | |
| 2491 | 2490 | if (ipv6.has_value()) { | |
| 2492 | 2491 | if (ipv6->host[0] == '\0' || ipv6->port == 0) return; | |
| 2493 | - CHECK(SocketAddress::New(AF_INET6, | ||
| 2494 | - ipv6->host, | ||
| 2495 | - ipv6->port, | ||
| 2496 | - &impl_->remote_address_)); | ||
| 2492 | + CHECK(SocketAddress::New( | ||
| 2493 | + AF_INET6, ipv6->host, ipv6->port, &impl_->remote_address_)); | ||
| 2497 | 2494 | preferredAddress->Use(ipv6.value()); | |
| 2498 | 2495 | } | |
| 2499 | 2496 | break; | |
@@ -2767,16 +2764,14 @@ void Session::EmitNewToken(const uint8_t* token, size_t len) { | |||
| 2767 | 2764 | CallbackScope<Session> cb_scope(this); | |
| 2768 | 2765 | ||
| 2769 | 2766 | Local<Value> argv[2]; | |
| 2770 | - auto buf = Buffer::Copy( | ||
| 2771 | - env(), reinterpret_cast<const char*>(token), len); | ||
| 2767 | + auto buf = Buffer::Copy(env(), reinterpret_cast<const char*>(token), len); | ||
| 2772 | 2768 | if (!buf.ToLocal(&argv[0])) return; | |
| 2773 | 2769 | argv[1] = SocketAddressBase::Create( | |
| 2774 | - env(), | ||
| 2775 | - std::make_shared<SocketAddress>(remote_address()))->object(); | ||
| 2776 | - MakeCallback( | ||
| 2777 | - BindingData::Get(env()).session_new_token_callback(), | ||
| 2778 | - arraysize(argv), | ||
| 2779 | - argv); | ||
| 2770 | + env(), std::make_shared<SocketAddress>(remote_address())) | ||
| 2771 | + ->object(); | ||
| 2772 | + MakeCallback(BindingData::Get(env()).session_new_token_callback(), | ||
| 2773 | + arraysize(argv), | ||
| 2774 | + argv); | ||
| 2780 | 2775 | } | |
| 2781 | 2776 | ||
| 2782 | 2777 | void Session::EmitStream(const BaseObjectWeakPtr<Stream>& stream) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,15 @@ | |||
| 1 | 1 | #if HAVE_OPENSSL | |
| 2 | 2 | #include "guard.h" | |
| 3 | 3 | #ifndef OPENSSL_NO_QUIC | |
| 4 | - #include "sessionticket.h" | ||
| 5 | - #include "tlscontext.h" | ||
| 6 | - #include "session.h" | ||
| 7 | - #include <node_sockaddr-inl.h> | ||
| 8 | 4 | #include <env-inl.h> | |
| 9 | 5 | #include <memory_tracker-inl.h> | |
| 10 | 6 | #include <ngtcp2/ngtcp2_crypto.h> | |
| 11 | 7 | #include <node_buffer.h> | |
| 12 | 8 | #include <node_errors.h> | |
| 9 | + #include <node_sockaddr-inl.h> | ||
| 10 | + #include "session.h" | ||
| 11 | + #include "sessionticket.h" | ||
| 12 | + #include "tlscontext.h" | ||
| 13 | 13 | ||
| 14 | 14 | namespace node { | |
| 15 | 15 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments