@fails-components/webtransport 0.1.0 → 0.1.3
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 +26 -43
- package/build.js +18 -3
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/stream.d.ts.map +1 -1
- package/lib/session.js +4 -1
- package/lib/stream.js +16 -10
- package/package.json +2 -2
- package/platform/icufix/fakedata.cpp +8 -0
- package/platform/quiche_platform_impl/quiche_logging_impl.h +1 -133
- package/platform/quiche_platform_impl/quiche_stack_trace_impl.h +1 -0
- package/src/http3client.cc +12 -6
- package/src/http3client.h +2 -2
- package/src/http3eventloop.cc +5 -4
- package/src/http3server.cc +1 -2
- package/src/http3serversession.cc +1 -1
- package/src/http3serversession.h +3 -3
- package/src/http3wtstreamvisitor.cc +12 -4
- package/src/http3wtstreamvisitor.h +6 -1
- package/platform/quiche_platform_impl/quiche_logging_impl.cc +0 -7
package/CMakeLists.txt
CHANGED
|
@@ -19,25 +19,6 @@ set(BUILD_TESTING OFF)
|
|
|
19
19
|
set(protobuf_BUILD_PROTOC_BINARIES ON)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
IF( NOT WIN32)
|
|
23
|
-
IF(APPLE)
|
|
24
|
-
IF(DEFINED ENV{LOCALHOMEWBREWICU})
|
|
25
|
-
MESSAGE(STATUS "Local homebrew icu detected")
|
|
26
|
-
MESSAGE(STATUS $ENV{LOCALHOMEWBREWICU})
|
|
27
|
-
SET(ICU_ROOT $ENV{LOCALHOMEWBREWICU})
|
|
28
|
-
ELSE()
|
|
29
|
-
IF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
|
|
30
|
-
MESSAGE(STATUS "set icu root local")
|
|
31
|
-
SET(ICU_ROOT "/usr/local/opt/icu4c")
|
|
32
|
-
ELSE()
|
|
33
|
-
MESSAGE(STATUS "set icu root homebrew")
|
|
34
|
-
SET(ICU_ROOT "/opt/homebrew/icu4c")
|
|
35
|
-
ENDIF()
|
|
36
|
-
ENDIF()
|
|
37
|
-
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
|
38
|
-
ENDIF(APPLE)
|
|
39
|
-
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
|
40
|
-
ENDIF(NOT WIN32)
|
|
41
22
|
|
|
42
23
|
IF (WIN32)
|
|
43
24
|
add_compile_definitions(NOMINMAX)
|
|
@@ -93,8 +74,6 @@ endif(COMMAND cmake_policy)
|
|
|
93
74
|
add_compile_definitions(QUICHE_ENABLE_LIBEVENT)
|
|
94
75
|
|
|
95
76
|
|
|
96
|
-
IF (WIN32)
|
|
97
|
-
|
|
98
77
|
add_library(icu STATIC
|
|
99
78
|
#icu
|
|
100
79
|
third_party/icu/icu4c/source/common/appendable.cpp
|
|
@@ -160,10 +139,11 @@ add_library(icu STATIC
|
|
|
160
139
|
third_party/icu/icu4c/source/common/utypes.cpp
|
|
161
140
|
third_party/icu/icu4c/source/common/uvector.cpp
|
|
162
141
|
third_party/icu/icu4c/source/common/putil.cpp
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
)
|
|
143
|
+
target_include_directories(icu
|
|
165
144
|
PUBLIC third_party/icu/icu4c/source/common
|
|
166
|
-
|
|
145
|
+
)
|
|
146
|
+
if (WIN32)
|
|
167
147
|
target_sources(icu PRIVATE
|
|
168
148
|
third_party/icu/icu4c/source/common/wintz.cpp
|
|
169
149
|
)
|
|
@@ -171,20 +151,23 @@ add_library(icu STATIC
|
|
|
171
151
|
#hack since this function is not currently used
|
|
172
152
|
ICU_DATA_DIR_WINDOWS=""
|
|
173
153
|
)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
PRIVATE
|
|
177
|
-
|
|
178
|
-
U_COMMON_IMPLEMENTATION
|
|
154
|
+
else()
|
|
155
|
+
# fix data problem
|
|
156
|
+
target_sources(icu PRIVATE
|
|
157
|
+
platform/icufix/fakedata.cpp
|
|
179
158
|
)
|
|
159
|
+
endif()
|
|
180
160
|
|
|
181
|
-
|
|
161
|
+
target_compile_definitions(icu
|
|
162
|
+
PRIVATE U_DEFINE_FALSE_AND_TRUE=1
|
|
163
|
+
U_STATIC_IMPLEMENTATION
|
|
164
|
+
U_COMMON_IMPLEMENTATION
|
|
165
|
+
)
|
|
182
166
|
|
|
183
167
|
add_library(gquiche STATIC
|
|
184
168
|
#plattform impl
|
|
185
169
|
platform/quiche_platform_impl/quiche_export_impl.h
|
|
186
170
|
platform/quiche_platform_impl/quiche_logging_impl.h
|
|
187
|
-
platform/quiche_platform_impl/quiche_logging_impl.cc
|
|
188
171
|
platform/quiche_platform_impl/quiche_containers_impl.h
|
|
189
172
|
platform/quiche_platform_impl/quiche_client_stats_impl.h
|
|
190
173
|
platform/quiche_platform_impl/quiche_event_loop_impl.h
|
|
@@ -241,6 +224,8 @@ third_party/googleurl/url/url_parse_file.cc
|
|
|
241
224
|
third_party/googleurl/url/url_canon_host.cc
|
|
242
225
|
third_party/googleurl/url/url_canon_ip.cc
|
|
243
226
|
third_party/googleurl/url/url_constants.cc
|
|
227
|
+
third_party/googleurl/url/url_features.cc
|
|
228
|
+
third_party/googleurl/url/url_features.h
|
|
244
229
|
third_party/googleurl/url/url_util.cc
|
|
245
230
|
third_party/googleurl/url/url_util.h
|
|
246
231
|
third_party/googleurl/url/gurl.cc
|
|
@@ -273,6 +258,7 @@ third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_fl
|
|
|
273
258
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h
|
|
274
259
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc
|
|
275
260
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_prefetch_impl.h
|
|
261
|
+
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h
|
|
276
262
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.cc
|
|
277
263
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.h
|
|
278
264
|
third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_stack_trace_impl.cc
|
|
@@ -301,6 +287,8 @@ third_party/quiche/quiche/common/quiche_random.h
|
|
|
301
287
|
third_party/quiche/quiche/common/quiche_text_utils.cc
|
|
302
288
|
third_party/quiche/quiche/common/quiche_text_utils.h
|
|
303
289
|
third_party/quiche/quiche/common/simple_buffer_allocator.cc
|
|
290
|
+
third_party/quiche/quiche/common/structured_headers.h
|
|
291
|
+
third_party/quiche/quiche/common/structured_headers.cc
|
|
304
292
|
third_party/quiche/quiche/http2/adapter/data_source.h
|
|
305
293
|
third_party/quiche/quiche/http2/adapter/event_forwarder.cc
|
|
306
294
|
third_party/quiche/quiche/http2/adapter/event_forwarder.h
|
|
@@ -802,6 +790,8 @@ third_party/quiche/quiche/quic/core/quic_stream.h
|
|
|
802
790
|
third_party/quiche/quiche/quic/core/quic_stream_frame_data_producer.h
|
|
803
791
|
third_party/quiche/quiche/quic/core/quic_stream_id_manager.cc
|
|
804
792
|
third_party/quiche/quiche/quic/core/quic_stream_id_manager.h
|
|
793
|
+
third_party/quiche/quiche/quic/core/quic_stream_priority.cc
|
|
794
|
+
third_party/quiche/quiche/quic/core/quic_stream_priority.h
|
|
805
795
|
third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc
|
|
806
796
|
third_party/quiche/quiche/quic/core/quic_stream_send_buffer.h
|
|
807
797
|
third_party/quiche/quiche/quic/core/quic_stream_sequencer.cc
|
|
@@ -925,6 +915,8 @@ ELSE(WIN32)
|
|
|
925
915
|
)
|
|
926
916
|
ENDIF(WIN32)
|
|
927
917
|
|
|
918
|
+
target_compile_options(gquiche PRIVATE -flax-vector-conversions)
|
|
919
|
+
|
|
928
920
|
|
|
929
921
|
add_custom_command(
|
|
930
922
|
OUTPUT
|
|
@@ -989,12 +981,8 @@ PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
989
981
|
PUBLIC ${CMAKE_JS_INC}
|
|
990
982
|
)
|
|
991
983
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
ELSE(WIN32)
|
|
995
|
-
include_directories(gquiche PUBLIC ${ICU_INCLUDE_DIRS})
|
|
996
|
-
target_link_libraries(gquiche ICU::uc ICU::i18n)
|
|
997
|
-
ENDIF(WIN32)
|
|
984
|
+
|
|
985
|
+
target_include_directories(gquiche PUBLIC third_party/icu/icu4c/source/common)
|
|
998
986
|
|
|
999
987
|
target_link_libraries(gquiche
|
|
1000
988
|
absl::base
|
|
@@ -1023,13 +1011,8 @@ if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
|
|
|
1023
1011
|
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
|
|
1024
1012
|
endif()
|
|
1025
1013
|
|
|
1026
|
-
IF (WIN32)
|
|
1027
|
-
target_link_libraries(gquiche icu)
|
|
1028
|
-
ENDIF(WIN32)
|
|
1029
1014
|
|
|
1030
|
-
|
|
1031
|
-
target_compile_definitions (gquiche PRIVATE __APPLE_USE_RFC_3542)
|
|
1032
|
-
endif()
|
|
1015
|
+
target_link_libraries(gquiche icu)
|
|
1033
1016
|
|
|
1034
1017
|
|
|
1035
1018
|
# google quiche build parameters end
|
package/build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { arch, argv, env, platform } from 'node:process'
|
|
2
2
|
import { spawn } from 'node:child_process'
|
|
3
|
-
import { rename, mkdtemp, rm, access } from 'node:fs/promises'
|
|
3
|
+
import { cp, rename, mkdtemp, rm, access } from 'node:fs/promises'
|
|
4
4
|
import { constants } from 'node:fs'
|
|
5
5
|
import path from 'node:path'
|
|
6
6
|
import pkg from './package.json' assert { type: 'json' }
|
|
@@ -105,9 +105,16 @@ const extractthirdparty = async () => {
|
|
|
105
105
|
try {
|
|
106
106
|
await rm(destdir, { recursive: true, maxRetries: 10 })
|
|
107
107
|
} catch (err) {
|
|
108
|
-
console.log('destdir does not exist: ', err)
|
|
108
|
+
console.log('destdir does not exist (only warning, ignore): ', err)
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
await rename(path.join(copath, '/third_party'), destdir)
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.log('rename tmp dir failed:', error)
|
|
114
|
+
console.log('copy instead start... (can take a while)...')
|
|
115
|
+
await cp(path.join(copath, '/third_party'), destdir, {recursive: true})
|
|
116
|
+
console.log('copy instead finished')
|
|
109
117
|
}
|
|
110
|
-
await rename(path.join(copath, '/third_party'), destdir)
|
|
111
118
|
} catch (error) {
|
|
112
119
|
console.error('failed to get third party code from git', error)
|
|
113
120
|
fatal = true
|
|
@@ -289,6 +296,14 @@ if (argv.length > 2) {
|
|
|
289
296
|
process.exit(1)
|
|
290
297
|
}
|
|
291
298
|
break
|
|
299
|
+
case 'extract-thirdparty':
|
|
300
|
+
try {
|
|
301
|
+
// if we do not succeed, we have to build it ourselves
|
|
302
|
+
await extractthirdparty()
|
|
303
|
+
} catch (error) {
|
|
304
|
+
console.error('Extract third party failed: ', error)
|
|
305
|
+
}
|
|
306
|
+
break
|
|
292
307
|
default:
|
|
293
308
|
console.log('unsupported argument ', argv[2])
|
|
294
309
|
break
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../lib/session.js"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../lib/session.js"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;GAGG;AACH;IAsWE;;OAEG;IACH,sBAFW,iBAAiB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,cAAc,QAmC5G;IAzYD;;;;;OAKG;IACH;QA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@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../lib/stream.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH;
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../lib/stream.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH;IAmRE;;OAEG;IACH,sBAFW,qBAAqB,GAAG,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,wBAAwB,QAmClH;IAtTD;;;;;;;OAOG;IACH;QANqC,MAAM,EAAhC,mBAAmB;QACE,SAAS,EAA9B,cAAc;QACD,SAAS,EAAtB,MAAM;QACQ,aAAa,EAA3B,OAAO;QACO,QAAQ,EAAtB,OAAO;OAmHjB;IAhHC,8CAAyB;IAEzB,8CAA+B;IAC/B,kBAA+B;IAC/B,uBAAuC;IACvC,kBAA6B;IAC7B,gBAAmB;IAEnB,mCAAmC;IACnC,kBADW,QAAQ,IAAI,CAAC,GAAG,IAAI,CACH;IAC5B,mBAkGkB,IAAI,SAlGA;IAGpB,0CA+BC;IA5BK,uEAAoC;IAclC,kBA4EQ,IAAI,SA5EY;IAQ1B,wBAA0B;IAShC,0CAwDC;IArDK,yEAAoC;IA8ClC,iBAcQ,IAAI,SAdW;IAkBnC;;;OAGG;IACH,yBAHW,OAAO,SAAS,EAAE,qBAAqB,GACrC,IAAI,CAgDhB;IAhBO,oCAA0B;IAkBlC;;;OAGG;IACH,mBAHW,eAAe,GACb,IAAI,CAuBhB;IAED;;OAEG;IACH,oBAFW,gBAAgB,QAY1B;IAED;;OAEG;IACH,oBAFW,gBAAgB,QAe1B;IAED;;OAEG;IACH,4BAFW,wBAAwB,QAoClC;IAzBK,qCAA2B;CAgElC;;;;6CAtUY,OAAO,SAAS,EAAE,8BAA8B;;;;oCAChD,OAAO,SAAS,EAAE,qBAAqB;;;;8BACvC,OAAO,SAAS,EAAE,eAAe;;;;+BACjC,OAAO,SAAS,EAAE,gBAAgB;;;;+BAClC,OAAO,SAAS,EAAE,gBAAgB;;;;uCAClC,OAAO,SAAS,EAAE,wBAAwB;;;;kCAE1C,OAAO,SAAS,EAAE,mBAAmB;;;;6BAErC,OAAO,WAAW,EAAE,cAAc;;;;8CAElC,OAAO,YAAY,EAAE,+BAA+B"}
|
package/lib/session.js
CHANGED
|
@@ -295,7 +295,10 @@ export class Http3WTSession {
|
|
|
295
295
|
this.streamObjs.clear()
|
|
296
296
|
|
|
297
297
|
if (this.closedResolve)
|
|
298
|
-
this.closedResolve({
|
|
298
|
+
this.closedResolve({
|
|
299
|
+
closeCode: args.errorcode,
|
|
300
|
+
reason: args.error ? args.error : 'closed'
|
|
301
|
+
})
|
|
299
302
|
if (this.closeHook) {
|
|
300
303
|
this.closeHook()
|
|
301
304
|
delete this.closeHook
|
package/lib/stream.js
CHANGED
|
@@ -147,26 +147,32 @@ export class Http3WTStream {
|
|
|
147
147
|
onStreamRecvSignal(args) {
|
|
148
148
|
// console.log('onStreamRecvSignal', args)
|
|
149
149
|
// check if transport is closed
|
|
150
|
+
let parentcleanup = true
|
|
150
151
|
const parentstate = this.parentobj.state
|
|
151
|
-
if (parentstate === 'closed' || parentstate === 'failed')
|
|
152
|
+
if (parentstate === 'closed' || parentstate === 'failed') {
|
|
153
|
+
console.log('no parent cleanup as parent was closed or failed')
|
|
154
|
+
parentcleanup = false
|
|
155
|
+
}
|
|
152
156
|
switch (args.nettask) {
|
|
153
157
|
case 'resetStream':
|
|
154
158
|
if (this.readable) {
|
|
155
|
-
|
|
156
|
-
this.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
if (parentcleanup)
|
|
160
|
+
this.parentobj.removeReceiveStream(
|
|
161
|
+
this.readable,
|
|
162
|
+
this.readableController
|
|
163
|
+
)
|
|
159
164
|
this.readableclosed = true
|
|
160
165
|
this.readableController.error(args.code || 0)
|
|
161
|
-
} else console.log('stopSending
|
|
166
|
+
} else console.log('stopSending without readable')
|
|
162
167
|
break
|
|
163
168
|
|
|
164
169
|
case 'stopSending':
|
|
165
170
|
if (this.writable) {
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
if (parentcleanup)
|
|
172
|
+
this.parentobj.removeSendStream(
|
|
173
|
+
this.writable,
|
|
174
|
+
this.writableController
|
|
175
|
+
)
|
|
170
176
|
|
|
171
177
|
this.writableclosed = true
|
|
172
178
|
this.writableController.error(args.code || 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fails-components/webtransport",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A component to add webtransport support (server and client) to node.js using libquiche",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"mocha": "^10.1.0",
|
|
61
61
|
"node-forge": "^1.3.1",
|
|
62
62
|
"prettier": "^2.4.1",
|
|
63
|
-
"typescript": "
|
|
63
|
+
"typescript": "4.8.4"
|
|
64
64
|
},
|
|
65
65
|
"binary": {
|
|
66
66
|
"napi_versions": [
|
|
@@ -16,138 +16,6 @@
|
|
|
16
16
|
#ifndef QUICHE_COMMON_PLATFORM_NODE_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
|
|
17
17
|
#define QUICHE_COMMON_PLATFORM_NODE_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
|
|
18
18
|
|
|
19
|
-
#include
|
|
20
|
-
#include <iostream>
|
|
21
|
-
#include <sstream>
|
|
22
|
-
#include <string>
|
|
23
|
-
|
|
24
|
-
#include "absl/base/attributes.h"
|
|
25
|
-
|
|
26
|
-
namespace quiche {
|
|
27
|
-
|
|
28
|
-
class DevZeroBuf : public std::streambuf {
|
|
29
|
-
public:
|
|
30
|
-
std::streamsize xsputn (const char * s, std::streamsize n) override {
|
|
31
|
-
return n;
|
|
32
|
-
}
|
|
33
|
-
int overflow (int c) override {
|
|
34
|
-
return 1;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
class DevZeroStream : public std::ostream {
|
|
39
|
-
public:
|
|
40
|
-
DevZeroStream() : std::ostream (&buf) {}
|
|
41
|
-
private:
|
|
42
|
-
DevZeroBuf buf;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
class StdoutLogSink {
|
|
46
|
-
public:
|
|
47
|
-
constexpr StdoutLogSink(): condition(true) {}
|
|
48
|
-
|
|
49
|
-
constexpr StdoutLogSink(bool cond): condition(cond) {}
|
|
50
|
-
|
|
51
|
-
constexpr StdoutLogSink(int level): condition(level<=logverbose) {}
|
|
52
|
-
constexpr StdoutLogSink(const char*, bool cond): condition(cond) {}
|
|
53
|
-
constexpr StdoutLogSink(int level, bool cond): condition(level<=logverbose && cond) {}
|
|
54
|
-
|
|
55
|
-
template<typename T>
|
|
56
|
-
constexpr StdoutLogSink(T& ptr): condition(ptr) {}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
constexpr std::ostream& stream() { return (condition && !nolog) ? std::cout: dump; }
|
|
60
|
-
|
|
61
|
-
// This operator has lower precedence than << but higher than ?:, which is
|
|
62
|
-
// useful for implementing QUICHE_DISREGARD_LOG_STREAM below.
|
|
63
|
-
void operator&(std::ostream&) {}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
protected:
|
|
67
|
-
bool condition;
|
|
68
|
-
static DevZeroStream dump;
|
|
69
|
-
static const int logverbose=1;
|
|
70
|
-
const bool nolog= true;
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// We need to actually implement LOG(FATAL), otherwise some functions will fail
|
|
76
|
-
// to compile due to the "failed to return value from non-void function" error.
|
|
77
|
-
class FatalLogSink : public StdoutLogSink {
|
|
78
|
-
public:
|
|
79
|
-
ABSL_ATTRIBUTE_NORETURN ~FatalLogSink() { abort(); }
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
} // namespace quiche
|
|
83
|
-
|
|
84
|
-
#define QUICHE_DVLOG_IMPL(verbose_level) \
|
|
85
|
-
::quiche::StdoutLogSink(#verbose_level).stream()
|
|
86
|
-
#define QUICHE_DVLOG_IF_IMPL(verbose_level, condition) \
|
|
87
|
-
::quiche::StdoutLogSink(#verbose_level, condition).stream()
|
|
88
|
-
#define QUICHE_DLOG_IMPL(severity) ::quiche::StdoutLogSink(#severity).stream()
|
|
89
|
-
#define QUICHE_DLOG_IF_IMPL(severity, condition) \
|
|
90
|
-
::quiche::StdoutLogSink(#severity, condition).stream()
|
|
91
|
-
#define QUICHE_VLOG_IMPL(verbose_level) \
|
|
92
|
-
::quiche::StdoutLogSink(#verbose_level).stream()
|
|
93
|
-
#define QUICHE_LOG_FIRST_N_IMPL(severity, n) \
|
|
94
|
-
::quiche::StdoutLogSink(#severity, n).stream()
|
|
95
|
-
#define QUICHE_LOG_EVERY_N_SEC_IMPL(severity, seconds) \
|
|
96
|
-
::quiche::StdoutLogSink(#severity, seconds).stream()
|
|
97
|
-
#define QUICHE_LOG_IF_IMPL(severity, condition) \
|
|
98
|
-
::quiche::StdoutLogSink(#severity, condition).stream()
|
|
99
|
-
|
|
100
|
-
#define QUICHE_LOG_IMPL(severity) QUICHE_LOG_IMPL_##severity()
|
|
101
|
-
#define QUICHE_LOG_IMPL_FATAL() ::quiche::FatalLogSink().stream()
|
|
102
|
-
#define QUICHE_LOG_IMPL_DFATAL() ::quiche::StdoutLogSink().stream()
|
|
103
|
-
#define QUICHE_LOG_IMPL_ERROR() ::quiche::StdoutLogSink().stream()
|
|
104
|
-
#define QUICHE_LOG_IMPL_WARNING() ::quiche::StdoutLogSink().stream()
|
|
105
|
-
#define QUICHE_LOG_IMPL_INFO() ::quiche::StdoutLogSink().stream()
|
|
106
|
-
|
|
107
|
-
#define QUICHE_PREDICT_FALSE_IMPL(x) (x)
|
|
108
|
-
#define QUICHE_PREDICT_TRUE_IMPL(x) (x)
|
|
109
|
-
|
|
110
|
-
#define QUICHE_PLOG_IMPL(severity) ::quiche::StdoutLogSink(#severity)
|
|
111
|
-
|
|
112
|
-
#define QUICHE_DLOG_INFO_IS_ON_IMPL() false
|
|
113
|
-
#define QUICHE_LOG_INFO_IS_ON_IMPL() false
|
|
114
|
-
#define QUICHE_LOG_WARNING_IS_ON_IMPL() false
|
|
115
|
-
#define QUICHE_LOG_ERROR_IS_ON_IMPL() false
|
|
116
|
-
|
|
117
|
-
// This is necessary because we sometimes call QUICHE_DCHECK inside constexpr
|
|
118
|
-
// functions, and then write non-constexpr expressions into the resulting log.
|
|
119
|
-
#define QUICHE_DISREGARD_LOG_STREAM(stream) \
|
|
120
|
-
true ? (void)0 : ::quiche::StdoutLogSink() & (stream)
|
|
121
|
-
|
|
122
|
-
#define QUICHE_CHECK_IMPL(condition) ::quiche::StdoutLogSink(condition).stream()
|
|
123
|
-
#define QUICHE_CHECK_EQ_IMPL(val1, val2) \
|
|
124
|
-
::quiche::StdoutLogSink((val1)==(val2)).stream()
|
|
125
|
-
#define QUICHE_CHECK_NE_IMPL(val1, val2) \
|
|
126
|
-
::quiche::StdoutLogSink((val1)!=(val2)).stream()
|
|
127
|
-
#define QUICHE_CHECK_LE_IMPL(val1, val2) \
|
|
128
|
-
::quiche::StdoutLogSink((val1)<=(val2)).stream()
|
|
129
|
-
#define QUICHE_CHECK_LT_IMPL(val1, val2) \
|
|
130
|
-
::quiche::StdoutLogSink((val1)<(val2)).stream()
|
|
131
|
-
#define QUICHE_CHECK_GE_IMPL(val1, val2) \
|
|
132
|
-
::quiche::StdoutLogSink((val1)>=(val2)).stream()
|
|
133
|
-
#define QUICHE_CHECK_GT_IMPL(val1, val2) \
|
|
134
|
-
::quiche::StdoutLogSink((val1)>(val2)).stream()
|
|
135
|
-
|
|
136
|
-
#define QUICHE_DCHECK_IMPL(condition) \
|
|
137
|
-
QUICHE_DISREGARD_LOG_STREAM(::quiche::StdoutLogSink(condition).stream())
|
|
138
|
-
#define QUICHE_DCHECK_EQ_IMPL(val1, val2) \
|
|
139
|
-
::quiche::StdoutLogSink((val1)==(val2)).stream()
|
|
140
|
-
#define QUICHE_DCHECK_NE_IMPL(val1, val2) \
|
|
141
|
-
::quiche::StdoutLogSink((val1)!=(val2)).stream()
|
|
142
|
-
#define QUICHE_DCHECK_LE_IMPL(val1, val2) \
|
|
143
|
-
::quiche::StdoutLogSink((val1)<=(val2)).stream()
|
|
144
|
-
#define QUICHE_DCHECK_LT_IMPL(val1, val2) \
|
|
145
|
-
::quiche::StdoutLogSink((val1)<(val2)).stream()
|
|
146
|
-
#define QUICHE_DCHECK_GE_IMPL(val1, val2) \
|
|
147
|
-
::quiche::StdoutLogSink((val1)>=(val2)).stream()
|
|
148
|
-
#define QUICHE_DCHECK_GT_IMPL(val1, val2) \
|
|
149
|
-
::quiche::StdoutLogSink((val1)>(val2)).stream()
|
|
150
|
-
|
|
151
|
-
#define QUICHE_NOTREACHED_IMPL() QUICHE_DCHECK_IMPL(false)
|
|
19
|
+
#include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h"
|
|
152
20
|
|
|
153
21
|
#endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
|
package/src/http3client.cc
CHANGED
|
@@ -183,7 +183,7 @@ namespace quic
|
|
|
183
183
|
|
|
184
184
|
void Http3Client::Initialize()
|
|
185
185
|
{
|
|
186
|
-
priority_ =
|
|
186
|
+
priority_ = QuicStreamPriority();
|
|
187
187
|
connect_attempted_ = false;
|
|
188
188
|
auto_reconnect_ = false;
|
|
189
189
|
buffer_body_ = true;
|
|
@@ -390,8 +390,7 @@ namespace quic
|
|
|
390
390
|
SetLatestCreatedStream(stream);
|
|
391
391
|
if (latest_created_stream_)
|
|
392
392
|
{
|
|
393
|
-
latest_created_stream_->SetPriority(
|
|
394
|
-
spdy::SpdyStreamPrecedence(priority_));
|
|
393
|
+
latest_created_stream_->SetPriority(priority_);
|
|
395
394
|
}
|
|
396
395
|
finish(latest_created_stream_);
|
|
397
396
|
});
|
|
@@ -734,7 +733,15 @@ namespace quic
|
|
|
734
733
|
{
|
|
735
734
|
QUICHE_DCHECK(initialized_);
|
|
736
735
|
QUICHE_DCHECK(!connected());
|
|
737
|
-
QuicPacketWriter *writer
|
|
736
|
+
QuicPacketWriter *writer;
|
|
737
|
+
if (eventloop_->getQuicEventLoop()->SupportsEdgeTriggered())
|
|
738
|
+
{
|
|
739
|
+
writer = new QuicDefaultPacketWriter(GetLatestFD());
|
|
740
|
+
}
|
|
741
|
+
else
|
|
742
|
+
{
|
|
743
|
+
writer = new LevelTriggeredPacketWriter(GetLatestFD(), eventloop_->getQuicEventLoop());
|
|
744
|
+
}
|
|
738
745
|
ParsedQuicVersion mutual_version = UnsupportedQuicVersion();
|
|
739
746
|
const bool can_reconnect_with_different_version =
|
|
740
747
|
CanReconnectWithDifferentVersion(&mutual_version);
|
|
@@ -931,8 +938,7 @@ namespace quic
|
|
|
931
938
|
bool success =
|
|
932
939
|
event_loop->ArtificiallyNotifyEvent(fd, kSocketEventReadable);
|
|
933
940
|
QUICHE_DCHECK(success);
|
|
934
|
-
}
|
|
935
|
-
if (!event_loop->SupportsEdgeTriggered())
|
|
941
|
+
} else if (!event_loop->SupportsEdgeTriggered())
|
|
936
942
|
{
|
|
937
943
|
bool success = event_loop->RearmSocket(fd, kSocketEventReadable);
|
|
938
944
|
QUICHE_DCHECK(success);
|
package/src/http3client.h
CHANGED
|
@@ -245,7 +245,7 @@ namespace quic
|
|
|
245
245
|
|
|
246
246
|
void set_auto_reconnect(bool reconnect) { auto_reconnect_ = reconnect; }
|
|
247
247
|
|
|
248
|
-
void set_priority(
|
|
248
|
+
void set_priority(QuicStreamPriority priority) { priority_ = priority; }
|
|
249
249
|
|
|
250
250
|
void WaitForWriteToFlush();
|
|
251
251
|
|
|
@@ -404,7 +404,7 @@ namespace quic
|
|
|
404
404
|
// Parsed response trailers (if present), copied from the stream in OnClose.
|
|
405
405
|
spdy::Http2HeaderBlock response_trailers_;
|
|
406
406
|
|
|
407
|
-
|
|
407
|
+
QuicStreamPriority priority_;
|
|
408
408
|
std::string response_;
|
|
409
409
|
// bytes_read_ and bytes_written_ are updated only when stream_ is released;
|
|
410
410
|
// prefer bytes_read() and bytes_written() member functions.
|
package/src/http3eventloop.cc
CHANGED
|
@@ -107,8 +107,10 @@ namespace quic
|
|
|
107
107
|
void Http3EventLoop::Schedule(std::function<void()> action)
|
|
108
108
|
{
|
|
109
109
|
// QUICHE_DCHECK(!quit_.HasBeenNotified());
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
{
|
|
111
|
+
QuicWriterMutexLock lock(&scheduled_actions_lock_);
|
|
112
|
+
scheduled_actions_.push_back(std::move(action));
|
|
113
|
+
}
|
|
112
114
|
dynamic_cast<LibeventQuicEventLoop *>(quic_event_loop_.get())->WakeUp();
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -363,12 +365,11 @@ namespace quic
|
|
|
363
365
|
if (!checkQw())
|
|
364
366
|
return;
|
|
365
367
|
HandleScope scope(qw_->Env());
|
|
366
|
-
|
|
367
368
|
Http3Constructors *constr = qw_->Env().GetInstanceData<Http3Constructors>();
|
|
368
369
|
Napi::Object strobj = constr->stream.New({});
|
|
369
370
|
Http3WTStreamJS *strjs = Napi::ObjectWrap<Http3WTStreamJS>::Unwrap(strobj);
|
|
370
371
|
strjs->setObj(stream);
|
|
371
|
-
strjs->Ref();
|
|
372
|
+
if (!stream->gone()) strjs->Ref();
|
|
372
373
|
stream->setJS(strjs);
|
|
373
374
|
|
|
374
375
|
Napi::Object objVal = sessionobj->getJS()->Value();
|
package/src/http3server.cc
CHANGED
|
@@ -342,8 +342,7 @@ namespace quic
|
|
|
342
342
|
bool success =
|
|
343
343
|
event_loop->ArtificiallyNotifyEvent(fd, kSocketEventReadable);
|
|
344
344
|
QUICHE_DCHECK(success);
|
|
345
|
-
}
|
|
346
|
-
if (!event_loop->SupportsEdgeTriggered())
|
|
345
|
+
} else if (!event_loop->SupportsEdgeTriggered())
|
|
347
346
|
{
|
|
348
347
|
bool success = event_loop->RearmSocket(fd, kSocketEventReadable);
|
|
349
348
|
QUICHE_DCHECK(success);
|
|
@@ -225,7 +225,7 @@ namespace quic
|
|
|
225
225
|
QUICHE_DCHECK_EQ(promised_info.stream_id, promised_stream->id());
|
|
226
226
|
QUIC_DLOG(INFO) << "created server push stream " << promised_stream->id();
|
|
227
227
|
|
|
228
|
-
promised_stream->SetPriority(promised_info.
|
|
228
|
+
promised_stream->SetPriority(promised_info.priority);
|
|
229
229
|
|
|
230
230
|
spdy::Http2HeaderBlock request_headers(
|
|
231
231
|
std::move(promised_info.request_headers));
|
package/src/http3serversession.h
CHANGED
|
@@ -44,14 +44,14 @@ namespace quic
|
|
|
44
44
|
public:
|
|
45
45
|
PromisedStreamInfo(spdy::Http2HeaderBlock request_headers,
|
|
46
46
|
QuicStreamId stream_id,
|
|
47
|
-
const
|
|
47
|
+
const QuicStreamPriority &priority)
|
|
48
48
|
: request_headers(std::move(request_headers)),
|
|
49
49
|
stream_id(stream_id),
|
|
50
|
-
|
|
50
|
+
priority(priority),
|
|
51
51
|
is_cancelled(false) {}
|
|
52
52
|
spdy::Http2HeaderBlock request_headers;
|
|
53
53
|
QuicStreamId stream_id;
|
|
54
|
-
|
|
54
|
+
QuicStreamPriority priority;
|
|
55
55
|
bool is_cancelled;
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -23,12 +23,20 @@ namespace quic
|
|
|
23
23
|
|
|
24
24
|
stream_->chunks_.pop_front();
|
|
25
25
|
}
|
|
26
|
+
if (!stream_->stop_sending_received_)
|
|
27
|
+
{
|
|
28
|
+
stream_->eventloop_->informStreamRecvSignal(stream_, 0, NetworkTask::stopSending);
|
|
29
|
+
}
|
|
30
|
+
if (!stream_->stream_was_reset_)
|
|
31
|
+
{
|
|
32
|
+
stream_->eventloop_->informStreamRecvSignal(stream_, 0, NetworkTask::resetStream);
|
|
33
|
+
}
|
|
26
34
|
Http3WTStreamJS *strobj = stream_->getJS();
|
|
27
35
|
if (strobj) {
|
|
28
36
|
stream_->stream_ = nullptr;
|
|
29
37
|
stream_->eventloop_->informUnref(strobj);
|
|
30
38
|
} else {
|
|
31
|
-
|
|
39
|
+
stream_->stream_ = nullptr;
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
|
|
@@ -48,6 +56,7 @@ namespace quic
|
|
|
48
56
|
// replying with a FIN rather than a RESET_STREAM is more appropriate here.
|
|
49
57
|
stream_->send_fin_ = true;
|
|
50
58
|
OnCanWrite();*/
|
|
59
|
+
stream_->stream_was_reset_ = true;
|
|
51
60
|
lasterror = error;
|
|
52
61
|
stream_->eventloop_->informStreamRecvSignal(stream_, error, NetworkTask::resetStream); // may be move below
|
|
53
62
|
}
|
|
@@ -112,9 +121,8 @@ namespace quic
|
|
|
112
121
|
if (send_fin_)
|
|
113
122
|
{
|
|
114
123
|
bool success = stream_->SendFin();
|
|
115
|
-
|
|
116
|
-
fin_was_sent_ = true;
|
|
124
|
+
if (success) fin_was_sent_ = true;
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
}
|
|
128
|
+
}
|
|
@@ -34,7 +34,7 @@ namespace quic
|
|
|
34
34
|
friend Http3WTStreamJS;
|
|
35
35
|
|
|
36
36
|
public:
|
|
37
|
-
Http3WTStream(WebTransportStream *stream, Http3EventLoop *eventloop) : stream_(stream), eventloop_(eventloop)
|
|
37
|
+
Http3WTStream(WebTransportStream *stream, Http3EventLoop *eventloop) : stream_(stream), eventloop_(eventloop), js_(nullptr)
|
|
38
38
|
{
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -109,6 +109,10 @@ namespace quic
|
|
|
109
109
|
js_ = js;
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
+
bool gone() {
|
|
113
|
+
return !stream_;
|
|
114
|
+
}
|
|
115
|
+
|
|
112
116
|
protected:
|
|
113
117
|
// internal functions called by js object
|
|
114
118
|
void startReadingInt()
|
|
@@ -211,6 +215,7 @@ namespace quic
|
|
|
211
215
|
bool stop_sending_received_ = false;
|
|
212
216
|
bool pause_reading_ = false;
|
|
213
217
|
bool can_read_pending_ = false;
|
|
218
|
+
bool stream_was_reset_ = false;
|
|
214
219
|
std::deque<WChunks> chunks_;
|
|
215
220
|
};
|
|
216
221
|
|