Skip to content

Commit 1a88acb

Browse files
committed
quic: fixup linting/formatting issues
Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode/Opus 4.6 PR-URL: #62387 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
1 parent 79b960a commit 1a88acb

File tree

12 files changed

+84
-110
lines changed

12 files changed

+84
-110
lines changed

src/node_blob.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,7 @@ void Blob::Reader::Pull(const FunctionCallbackInfo<Value>& args) {
411411
std::move(next), node::bob::OPTIONS_END, nullptr, 0));
412412
}
413413

414-
void Blob::Reader::SetWakeup(
415-
const FunctionCallbackInfo<Value>& args) {
414+
void Blob::Reader::SetWakeup(const FunctionCallbackInfo<Value>& args) {
416415
Blob::Reader* reader;
417416
ASSIGN_OR_RETURN_UNWRAP(&reader, args.This());
418417
CHECK(args[0]->IsFunction());

src/quic/application.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ ssize_t Session::Application::WriteVStream(PathStorage* path,
452452
if (stream_data.fin) flags |= NGTCP2_WRITE_STREAM_FLAG_FIN;
453453
return ngtcp2_conn_writev_stream(*session_,
454454
&path->path,
455-
// TODO(@jasnell): ECN blocked on libuv
455+
// TODO(@jasnell): ECN blocked on libuv
456456
nullptr,
457457
dest,
458458
max_packet_size,
@@ -583,7 +583,6 @@ class DefaultApplication final : public Session::Application {
583583

584584
void ResumeStream(int64_t id) override { ScheduleStream(id); }
585585

586-
587586
void BlockStream(int64_t id) override {
588587
if (auto stream = session().FindStream(id)) [[likely]] {
589588
stream->EmitBlocked();
@@ -608,7 +607,6 @@ class DefaultApplication final : public Session::Application {
608607
}
609608
}
610609

611-
612610
Stream::Queue stream_queue_;
613611
};
614612

src/quic/application.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ struct Session::Application::StreamData final {
155155
BaseObjectPtr<Stream> stream;
156156

157157
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),
161161
"ngtcp2_vec and nghttp3_vec must have identical layout");
162162
inline operator nghttp3_vec*() {
163163
return reinterpret_cast<nghttp3_vec*>(data);

src/quic/bindingdata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Packet;
4343
V(session_datagram_status, SessionDatagramStatus) \
4444
V(session_handshake, SessionHandshake) \
4545
V(session_new, SessionNew) \
46-
V(session_new_token, SessionNewToken) \
46+
V(session_new_token, SessionNewToken) \
4747
V(session_path_validation, SessionPathValidation) \
4848
V(session_ticket, SessionTicket) \
4949
V(session_version_negotiation, SessionVersionNegotiation) \

src/quic/endpoint.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ class Endpoint::UDP::Impl final : public HandleWrap {
324324
DCHECK_NOT_NULL(impl->endpoint_);
325325

326326
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);
329328
};
330329

331330
// Nothing to do in these cases. Specifically, if the nread
@@ -343,9 +342,8 @@ class Endpoint::UDP::Impl final : public HandleWrap {
343342
return;
344343
}
345344

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));
349347
}
350348

351349
uv_udp_t handle_;
@@ -999,7 +997,6 @@ void Endpoint::Destroy(CloseContext context, int status) {
999997
this, "Destroying endpoint due to \"%s\" with status %d", ctx, status);
1000998
}
1001999

1002-
10031000
state_->listening = 0;
10041001

10051002
close_context_ = context;
@@ -1365,9 +1362,8 @@ void Endpoint::Receive(const uv_buf_t& buf,
13651362
// trusted networks), we skip the Retry and allow 0-RTT to
13661363
// proceed without additional validation.
13671364
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);
13711367
SendRetry(PathDescriptor{
13721368
version,
13731369
dcid,

src/quic/endpoint.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ class Endpoint final : public AsyncWrap, public Packet::Listener {
311311
// be prevented.
312312
void CloseGracefully();
313313

314-
315314
void PacketDone(int status) override;
316315

317316
void EmitNewSession(const BaseObjectPtr<Session>& session);

src/quic/http3.cc

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ class Http3ApplicationImpl final : public Session::Application {
455455
}
456456

457457
void SetStreamPriority(const Stream& stream,
458-
StreamPriority priority,
459-
StreamPriorityFlags flags) override {
458+
StreamPriority priority,
459+
StreamPriorityFlags flags) override {
460460
nghttp3_pri pri;
461461
pri.inc = (flags == StreamPriorityFlags::NON_INCREMENTAL) ? 0 : 1;
462462
switch (priority) {
@@ -471,8 +471,7 @@ class Http3ApplicationImpl final : public Session::Application {
471471
break;
472472
}
473473
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);
476475
}
477476
// Client-side priority is set at request submission time via
478477
// nghttp3_conn_submit_request and is not typically changed
@@ -536,12 +535,10 @@ class Http3ApplicationImpl final : public Session::Application {
536535
nghttp3_err_infer_quic_app_error_code(err)));
537536
return false;
538537
}
539-
if (data->stream)
540-
data->stream->Commit(datalen, data->fin);
538+
if (data->stream) data->stream->Commit(datalen, data->fin);
541539
return true;
542540
}
543541

544-
545542
SET_NO_MEMORY_INFO()
546543
SET_MEMORY_INFO_NAME(Http3ApplicationImpl)
547544
SET_SELF_SIZE(Http3ApplicationImpl)
@@ -724,9 +721,7 @@ class Http3ApplicationImpl final : public Session::Application {
724721
//
725722
// This can be called multiple times with a decreasing id as the
726723
// 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);
730725
session().Close(Session::CloseMethod::GRACEFUL);
731726
}
732727

@@ -799,42 +794,38 @@ class Http3ApplicationImpl final : public Session::Application {
799794
return 0;
800795
}
801796

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));
804798
nghttp3_ssize result = 0;
805799

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+
};
826818

827819
ngtcp2_vec data[kMaxVectorCount];
828820
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);
833825

834826
return result;
835827
}
836828

837-
838829
static int on_acked_stream_data(nghttp3_conn* conn,
839830
int64_t stream_id,
840831
uint64_t datalen,

src/quic/preferredaddress.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ std::optional<const PreferredAddress::AddressInfo> get_address_info(
3030
if constexpr (FAMILY == AF_INET) {
3131
if (!paddr.ipv4_present) return std::nullopt;
3232
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)
3536
return std::nullopt;
3637
} else {
3738
if (!paddr.ipv6_present) return std::nullopt;
3839
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)
4144
return std::nullopt;
4245
}
4346
return address;

src/quic/session.cc

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,7 @@ Maybe<Session::Options> Session::Options::From(Environment* env,
475475

476476
// Parse the optional NEW_TOKEN for address validation on reconnection.
477477
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) &&
480479
token_val->IsArrayBufferView()) {
481480
Store token_store;
482481
if (Store::From(token_val.As<ArrayBufferView>()).To(&token_store)) {
@@ -897,9 +896,8 @@ struct Session::Impl final : public MemoryRetainer {
897896
uint64_t max_streams,
898897
void* user_data) {
899898
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);
903901
return NGTCP2_SUCCESS;
904902
}
905903

@@ -1630,11 +1628,14 @@ bool Session::Receive(Store&& store,
16301628
// ngtcp2_conn_read_pkt here, we will need to double check that the
16311629
// session is not destroyed before we try doing anything with it
16321630
// (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());
16381639

16391640
switch (err) {
16401641
case 0: {
@@ -2477,10 +2478,8 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) {
24772478
auto ipv4 = preferredAddress->ipv4();
24782479
if (ipv4.has_value()) {
24792480
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_));
24842483
preferredAddress->Use(ipv4.value());
24852484
}
24862485
break;
@@ -2490,10 +2489,8 @@ void Session::SelectPreferredAddress(PreferredAddress* preferredAddress) {
24902489
auto ipv6 = preferredAddress->ipv6();
24912490
if (ipv6.has_value()) {
24922491
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_));
24972494
preferredAddress->Use(ipv6.value());
24982495
}
24992496
break;
@@ -2767,16 +2764,14 @@ void Session::EmitNewToken(const uint8_t* token, size_t len) {
27672764
CallbackScope<Session> cb_scope(this);
27682765

27692766
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);
27722768
if (!buf.ToLocal(&argv[0])) return;
27732769
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);
27802775
}
27812776

27822777
void Session::EmitStream(const BaseObjectWeakPtr<Stream>& stream) {

src/quic/sessionticket.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#if HAVE_OPENSSL && HAVE_QUIC
22
#include "guard.h"
33
#ifndef OPENSSL_NO_QUIC
4-
#include "sessionticket.h"
5-
#include "tlscontext.h"
6-
#include "session.h"
7-
#include <node_sockaddr-inl.h>
84
#include <env-inl.h>
95
#include <memory_tracker-inl.h>
106
#include <ngtcp2/ngtcp2_crypto.h>
117
#include <node_buffer.h>
128
#include <node_errors.h>
9+
#include <node_sockaddr-inl.h>
10+
#include "session.h"
11+
#include "sessionticket.h"
12+
#include "tlscontext.h"
1313

1414
namespace node {
1515

0 commit comments

Comments
 (0)