@fails-components/webtransport-transport-http3-quiche 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CMakeLists.txt CHANGED
@@ -495,6 +495,8 @@ third_party/quiche/quiche/quic/core/frames/quic_connection_close_frame.cc
495
495
  third_party/quiche/quiche/quic/core/frames/quic_connection_close_frame.h
496
496
  third_party/quiche/quiche/quic/core/frames/quic_crypto_frame.cc
497
497
  third_party/quiche/quiche/quic/core/frames/quic_crypto_frame.h
498
+ third_party/quiche/quiche/quic/core/frames/quic_datagram_frame.cc
499
+ third_party/quiche/quiche/quic/core/frames/quic_datagram_frame.h
498
500
  third_party/quiche/quiche/quic/core/frames/quic_frame.cc
499
501
  third_party/quiche/quiche/quic/core/frames/quic_frame.h
500
502
  third_party/quiche/quiche/quic/core/frames/quic_goaway_frame.cc
@@ -506,8 +508,6 @@ third_party/quiche/quiche/quic/core/frames/quic_immediate_ack_frame.h
506
508
  third_party/quiche/quiche/quic/core/frames/quic_inlined_frame.h
507
509
  third_party/quiche/quiche/quic/core/frames/quic_max_streams_frame.cc
508
510
  third_party/quiche/quiche/quic/core/frames/quic_max_streams_frame.h
509
- third_party/quiche/quiche/quic/core/frames/quic_message_frame.cc
510
- third_party/quiche/quiche/quic/core/frames/quic_message_frame.h
511
511
  third_party/quiche/quiche/quic/core/frames/quic_mtu_discovery_frame.h
512
512
  third_party/quiche/quiche/quic/core/frames/quic_new_connection_id_frame.cc
513
513
  third_party/quiche/quiche/quic/core/frames/quic_new_connection_id_frame.h
@@ -1 +1 @@
1
- {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../lib/socket.js"],"names":[],"mappings":"AAkFA;IACE;;OAEG;IAEH,kBAHW,OAAO,4BAA4B,EAAE,oBAAoB,GAAC,SAAS,EAc7E;IAVC,0CAA0C;IAE1C,WAFW,OAAO,YAAY,EAAE,MAAM,CAEZ;IAE1B,UAAqB;IACrB,oBAAuB;IAgCzB,qBASC;IAlCD,+BAGC;IAPC,iBAAoB;IACpB,gBAAmB;IAQrB;;OAEG;IAEH,mDAHW,OAAO,SAAS,EAAE,mBAAmB,WAiB/C;CAYF"}
1
+ {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../lib/socket.js"],"names":[],"mappings":"AA4FA;IACE;;OAEG;IAEH,kBAHW,OAAO,4BAA4B,EAAE,oBAAoB,GAAC,SAAS,EAc7E;IAVC,0CAA0C;IAE1C,WAFW,OAAO,YAAY,EAAE,MAAM,CAEZ;IAE1B,UAAqB;IACrB,oBAAuB;IA+BzB,qBAQC;IAhCD,+BAGC;IAPC,iBAAoB;IACpB,gBAAmB;IAQrB;;OAEG;IAEH,mDAHW,OAAO,SAAS,EAAE,mBAAmB,WAgB/C;CAWF"}
package/lib/socket.js CHANGED
@@ -7,7 +7,17 @@ globalThis.FAILSsetTimeoutAlarm = (
7
7
  /** @type {{ fireJS: () => void; }} */ alarm,
8
8
  /** @type {number} */ delay
9
9
  ) => {
10
- return setTimeout(alarm.fireJS.bind(alarm), delay)
10
+ if (delay < 1) {
11
+ return { immediate: setImmediate(alarm.fireJS.bind(alarm)) }
12
+ }
13
+ return { timeout: setTimeout(alarm.fireJS.bind(alarm), delay) }
14
+ }
15
+
16
+ globalThis.FAILSclearTimeoutAlarm = (
17
+ /** @type {{ timeout: string | number | NodeJS.Timeout | undefined; immediate: NodeJS.Immediate | undefined; }} */ obj
18
+ ) => {
19
+ if (obj.timeout) clearTimeout(obj.timeout)
20
+ if (obj.immediate) clearImmediate(obj.immediate)
11
21
  }
12
22
 
13
23
  function convertToPem(/** @type {ArrayBuffer} */ cert) {
@@ -117,7 +127,6 @@ export class Http3WebTransportSocket {
117
127
  address,
118
128
  this.packetSendCB
119
129
  )
120
- // @ts-ignore
121
130
  const blocked = this.socketInt.getSendQueueCount() > 0
122
131
  this.blocked = this.blocked || blocked
123
132
  return blocked
@@ -126,7 +135,6 @@ export class Http3WebTransportSocket {
126
135
  packetSendCB() {
127
136
  if (
128
137
  !this.closed &&
129
- // @ts-ignore
130
138
  this.socketInt.getSendQueueCount() === 0 &&
131
139
  this.blocked
132
140
  ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fails-components/webtransport-transport-http3-quiche",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "A component to add webtransport support (server and client) to node.js, transport using libquiche",
5
5
  "exports": {
6
6
  ".": {
@@ -8,7 +8,7 @@
8
8
  }
9
9
  },
10
10
  "engines": {
11
- "node": ">=16.5"
11
+ "node": ">=20"
12
12
  },
13
13
  "type": "module",
14
14
  "types": "./dist/lib/index.d.ts",
@@ -109,20 +109,6 @@ namespace quic
109
109
  return stream;
110
110
  }
111
111
 
112
- Http3ServerStream *
113
- Http3ServerSession::CreateOutgoingUnidirectionalStream()
114
- {
115
- if (!ShouldCreateOutgoingUnidirectionalStream())
116
- {
117
- return nullptr;
118
- }
119
-
120
- Http3ServerStream *stream = new Http3ServerStream(
121
- GetNextOutgoingUnidirectionalStreamId(), this, WRITE_UNIDIRECTIONAL,
122
- http3_server_backend_);
123
- ActivateStream(absl::WrapUnique(stream));
124
- return stream;
125
- }
126
112
 
127
113
  void Http3ServerSession::OnCanCreateNewOutgoingStream(bool unidirectional) {
128
114
  if (SupportsWebTransport()) {
@@ -63,7 +63,6 @@ namespace quic
63
63
  QuicSpdyStream *CreateIncomingStream(QuicStreamId id) override;
64
64
  QuicSpdyStream *CreateIncomingStream(PendingStream *pending) override;
65
65
  QuicSpdyStream *CreateOutgoingBidirectionalStream() override;
66
- Http3ServerStream *CreateOutgoingUnidirectionalStream() override;
67
66
 
68
67
  // QuicServerSessionBaseMethod:
69
68
  std::unique_ptr<QuicCryptoServerStreamBase> CreateQuicCryptoServerStream(
@@ -138,10 +138,11 @@ namespace quic
138
138
  while (chunks_.size() > 0)
139
139
  {
140
140
  auto cur = chunks_.front();
141
- bool success = stream_->Write(absl::string_view(cur.buffer, cur.len));
141
+ absl::Status status =
142
+ WriteIntoStream(*stream_, absl::string_view(cur.buffer, cur.len));
142
143
  QUIC_DVLOG(1) << "Attempted writing on WebTransport bidirectional stream "
143
- << ", success: " << (success ? "yes" : "no");
144
- if (!success)
144
+ << ", success: " << status;
145
+ if (!status.ok())
145
146
  {
146
147
  return;
147
148
  }
@@ -153,8 +154,8 @@ namespace quic
153
154
 
154
155
  if (send_fin_)
155
156
  {
156
- bool success = stream_->SendFin();
157
- if (success) {
157
+ absl::Status status = SendFinOnStream(*stream_);
158
+ if (status.ok()) {
158
159
  fin_was_sent_ = true;
159
160
  getJS()->processStreamNetworkFinish(NetworkTask::streamFinal);
160
161
  }
@@ -14,7 +14,7 @@
14
14
  namespace quic
15
15
  {
16
16
  Napi::FunctionReference NapiAlarmJS::FAILSsetTimeoutAlarm_;
17
- Napi::FunctionReference NapiAlarmJS::clearTimeout_;
17
+ Napi::FunctionReference NapiAlarmJS::FAILSclearTimeoutAlarm_;
18
18
 
19
19
  void NapiAlarmJS::fireJS(const Napi::CallbackInfo &info)
20
20
  {
@@ -57,9 +57,9 @@ namespace quic
57
57
  FAILSsetTimeoutAlarm_ = Napi::Persistent(Env().Global().Get("FAILSsetTimeoutAlarm").As<Napi::Function>());
58
58
  FAILSsetTimeoutAlarm_.SuppressDestruct();
59
59
  }
60
- if (clearTimeout_.IsEmpty()) {
61
- clearTimeout_ = Napi::Persistent(Env().Global().Get("clearTimeout").As<Napi::Function>());
62
- clearTimeout_.SuppressDestruct();
60
+ if (FAILSclearTimeoutAlarm_.IsEmpty()) {
61
+ FAILSclearTimeoutAlarm_ = Napi::Persistent(Env().Global().Get("FAILSclearTimeoutAlarm").As<Napi::Function>());
62
+ FAILSclearTimeoutAlarm_.SuppressDestruct();
63
63
  }
64
64
  }
65
65
 
@@ -86,7 +86,7 @@ namespace quic
86
86
  protected:
87
87
  NapiAlarm* alarm_; // unowned
88
88
  static Napi::FunctionReference FAILSsetTimeoutAlarm_;
89
- static Napi::FunctionReference clearTimeout_;
89
+ static Napi::FunctionReference FAILSclearTimeoutAlarm_;
90
90
  };
91
91
 
92
92
  class NapiAlarm : public QuicAlarm
@@ -103,7 +103,7 @@ namespace quic
103
103
  {
104
104
  if (timerset_)
105
105
  {
106
- NapiAlarmJS::clearTimeout_.Call({alarmref_.Value()});
106
+ NapiAlarmJS::FAILSclearTimeoutAlarm_.Call({alarmref_.Value()});
107
107
  alarmref_.Unref();
108
108
  timerset_ = false;
109
109
  }
@@ -148,7 +148,7 @@ namespace quic
148
148
  {
149
149
  if (timerset_)
150
150
  {
151
- NapiAlarmJS::clearTimeout_.Call({alarmref_.Value()});
151
+ NapiAlarmJS::FAILSclearTimeoutAlarm_.Call({alarmref_.Value()});
152
152
  alarmref_.Unref();
153
153
  timerset_ = false;
154
154
  }