Skip to content

Commit 65f213b

Browse files
committed
quic: hopefully fixup windows build issues
1 parent ee923ac commit 65f213b

File tree

8 files changed

+32
-27
lines changed

8 files changed

+32
-27
lines changed

src/quic/application.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "application.h"
44
#include <node_sockaddr-inl.h>
55
#include <v8.h>
6+
#include "defs.h"
67
#include "endpoint.h"
78
#include "packet.h"
89
#include "session.h"
@@ -378,9 +379,7 @@ class DefaultApplication final : public Session::Application {
378379
return i == cnt;
379380
};
380381

381-
if (!stream_data.stream || !is_empty(stream_data.buf, stream_data.count))
382-
return false;
383-
return true;
382+
return stream_data.stream && is_empty(stream_data.buf, stream_data.count);
384383
}
385384

386385
bool StreamCommit(StreamData* stream_data, size_t datalen) override {

src/quic/bindingdata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ constexpr size_t kMaxVectorCount = 16;
149149
V(max_connections_total, "maxConnectionsTotal") \
150150
V(max_datagram_frame_size, "maxDatagramFrameSize") \
151151
V(max_field_section_size, "maxFieldSectionSize") \
152-
V(max_header_length, "maxHeaderLength"); \
152+
V(max_header_length, "maxHeaderLength") \
153153
V(max_header_pairs, "maxHeaderPairs") \
154154
V(max_idle_timeout, "maxIdleTimeout") \
155155
V(max_payload_size, "maxPayloadSize") \

src/quic/endpoint.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Endpoint::UDP::Impl final : public HandleWrap {
298298
return;
299299
}
300300

301-
impl->endpoint_->Receive(uv_buf_t{buf->base, static_cast<size_t>(nread)},
301+
impl->endpoint_->Receive(uv_buf_init(buf->base, static_cast<size_t>(nread)),
302302
SocketAddress(addr));
303303
}
304304

@@ -459,7 +459,7 @@ void Endpoint::Initialize(Environment* env, Local<Object> target) {
459459
#undef V
460460

461461
#define V(name, key, __) \
462-
auto IDX_STATE_ENDPOINT_##name = OffsetOf(&Endpoint::State::key);
462+
auto IDX_STATE_ENDPOINT_##name = offsetof(Endpoint::State, key);
463463
ENDPOINT_STATE(V)
464464
#undef V
465465

src/quic/endpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,10 @@ class Endpoint final : public AsyncWrap, public Packet::Listener {
268268
SET_MEMORY_INFO_NAME(Endpoint)
269269
SET_SELF_SIZE(Endpoint)
270270

271-
private:
272271
struct Stats;
273272
struct State;
274273

274+
private:
275275
class UDP final : public MemoryRetainer {
276276
public:
277277
explicit UDP(Endpoint* endpoint);

src/quic/session.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
10051015
bool 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

src/quic/session.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
6868

6969
// HTTP/3 specific options.
7070
uint64_t max_field_section_size = 0;
71-
size_t qpack_max_dtable_capacity = 0;
72-
size_t qpack_encoder_max_dtable_capacity = 0;
73-
size_t qpack_blocked_streams = 0;
71+
uint64_t qpack_max_dtable_capacity = 0;
72+
uint64_t qpack_encoder_max_dtable_capacity = 0;
73+
uint64_t qpack_blocked_streams = 0;
7474

7575
SET_NO_MEMORY_INFO()
7676
SET_MEMORY_INFO_NAME(Application::Options)
@@ -225,11 +225,12 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
225225
SET_MEMORY_INFO_NAME(Session)
226226
SET_SELF_SIZE(Session)
227227

228+
struct State;
229+
struct Stats;
230+
228231
private:
229232
struct Impl;
230233
struct MaybeCloseConnectionScope;
231-
struct State;
232-
struct Stats;
233234

234235
using StreamsMap = std::unordered_map<int64_t, BaseObjectPtr<Stream>>;
235236
using QuicConnectionPointer = DeleteFnPtr<ngtcp2_conn, ngtcp2_conn_del>;
@@ -327,6 +328,9 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
327328
BaseObjectPtr<LogStream> qlog() const;
328329
BaseObjectPtr<LogStream> keylog() const;
329330

331+
bool wants_session_ticket() const;
332+
void SetStreamOpenAllowed();
333+
330334
void set_wrapped();
331335

332336
void DoClose(bool silent = false);

src/quic/tlscontext.cc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
#include <ngtcp2/ngtcp2.h>
88
#include <ngtcp2/ngtcp2_crypto.h>
99
#include <ngtcp2/ngtcp2_crypto_openssl.h>
10+
#include <node_sockaddr-inl.h>
1011
#include <openssl/ssl.h>
1112
#include <v8.h>
1213
#include "bindingdata.h"
1314
#include "defs.h"
15+
#include "session.h"
1416
#include "transportparams.h"
1517

1618
namespace node {
@@ -29,18 +31,6 @@ namespace quic {
2931

3032
const TLSContext::Options TLSContext::Options::kDefault = {};
3133

32-
// TODO(@jasnell): This session class is just a placeholder.
33-
// The real session impl will be added in a separate commit.
34-
class Session {
35-
public:
36-
operator ngtcp2_conn*() { return nullptr; }
37-
void EmitKeylog(const char* line) const {}
38-
void EmitSessionTicket(Store&& store) {}
39-
void SetStreamOpenAllowed() {}
40-
bool is_destroyed() const { return false; }
41-
bool wants_session_ticket() const { return false; }
42-
};
43-
4434
namespace {
4535
constexpr size_t kMaxAlpnLen = 255;
4636

test/sequential/test-async-wrap-getasyncid.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ const { getSystemErrorName } = require('util');
7070
delete providers.QUIC_PACKET;
7171
delete providers.QUIC_UDP;
7272
delete providers.QUIC_ENDPOINT;
73+
delete providers.QUIC_SESSION;
74+
delete providers.QUIC_STREAM;
7375

7476
const objKeys = Object.keys(providers);
7577
if (objKeys.length > 0)

0 commit comments

Comments
 (0)