diff --git a/AGENTS.md b/AGENTS.md
index c721dc3..0d31605 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -51,32 +51,43 @@ holds only what is specific to trystero.
alone in a call of their own, without it, so the lint analyses the timer,
the sealer and the WebSockets without exceptions too. trystero raises
nothing of its own; a raise would go through `boost::throw_exception`.
-- **The external dependencies.** libsecp256k1 (every room), libdatachannel
- and OpenSSL (the native backend) are not part of Boost. `build.jam` finds
- them with webcpp's `webcpp.external` and `webcpp.external-found`
- (`tools/webcpp.jam`): where `-sSECP256K1_ROOT=
`,
- `-sSECP256K1_EMSCRIPTEN_ROOT=`, `-sLIBDATACHANNEL_ROOT=` and
- `-sOPENSSL_ROOT=` on b2's command line say, a relative one from b2's
- working directory, never the environment,
- else in the superproject's `.local/secp256k1-native`,
- `.local/secp256k1-emscripten`, `.local/libdatachannel` and
- `.local/openssl` when it holds the library's header, where webcpp's CI
- actions install them, until webcpp builds them from `third_party/`; so the
- reference and the lint need no `-s`. A library found in neither is looked
- for, natively outside Windows, in `/usr/include` or `/usr/local/include`,
- where a system install is legitimate. A `-s`
- that names a directory without its library's header stops the build,
- naming it. A library that no candidate holds leaves trystero out, its
- targets skipped, with one message that names the library and every place
- it looked, so that `b2 test` builds every other library; with
- `webcpp-require-external=on`, as the CI builds, it stops the build
- instead. With MSVC the names are CMake's and Shining
- Light's: `libsecp256k1`, linked with `SECP256K1_STATIC` defined, which a
- static libsecp256k1 needs on Windows, and `libssl` and `libcrypto`, also
- searched in `lib/VC/x64/MD`. libdatachannel is a
- C++ library: it must be built with the same standard library as the
- program that links it (libc++ for clang on macOS, libstdc++ for GCC), or
- the program does not link, though the native headers still compile alone.
+- **The dependencies.** libsecp256k1 (every room) remains an external
+ installation, found through `webcpp.external` and `webcpp.external-found`
+ at `-sSECP256K1_ROOT=` or `-sSECP256K1_EMSCRIPTEN_ROOT=`, then
+ `.local/secp256k1-native` or `.local/secp256k1-emscripten`. Native system
+ fallback outside Windows is allowed only for this dependency. A missing
+ installation leaves trystero out unless `webcpp-require-external=on`.
+ MSVC links its static `libsecp256k1.lib` with `SECP256K1_STATIC`.
+ The native backend instead names `/webcpp/third_party//libdatachannel`,
+ which builds pinned libdatachannel 0.24.6, libjuice, usrsctp and libsrtp as
+ separate static archives against `/webcpp/third_party//openssl` and its
+ matching generated headers. These are the same OpenSSL target used by
+ Asio and Beast, so a combined application has one provider. No
+ `LIBDATACHANNEL_ROOT`, `OPENSSL_ROOT` or installed binary is consulted.
+ Initialize their sources with `git submodule update --init --recursive
+ third_party/libs/libdatachannel third_party/libs/openssl`. Native builds
+ need CMake 3.21 or newer in addition to OpenSSL's Perl and Make/nmake.
+ B2 forwards the configured compiler, C++ ABI, runtime and optimization
+ flags, and isolates artifacts by their effective configuration. The
+ upstream source trees stay unchanged; verified staged copies are built.
+- **Native threading.** libdatachannel always uses worker threads, so every
+ consumer of `/webcpp/trystero//native` must declare `multi`,
+ including native headers-alone and reference targets. An explicit
+ single-threaded native backend fails with an actionable B2 diagnostic.
+ Asio and Beast still support their own single-threaded OpenSSL builds.
+- **Native channel handoff.** Valid frames received before a message handler
+ is installed wait in an app-resource FIFO, at most 64 frames for 10 s from
+ the first. Overflow or expiry closes the channel; close clears the queue.
+ `native/timer.hpp` holds the existing `native::timer`, still included by
+ `native/backend.hpp`, whose generation invalidates queued expiries.
+ Installing a receiver posts a resource-allocated flush, never an inline
+ call. Each frame checks the current handler and open channel, and a message
+ already posted ahead of the flush drains older frames when a receiver
+ exists. A transport closed during adoption, before binding, forgets its
+ negotiation and restarts announcements. `native_peer_connection` tests
+ real queued callbacks, FIFO, replacement, close, limits and resource release;
+ `shared` tests closure during adoption, and interop controls native open
+ delivery while a JS peer sends both rooms' presence first.
- **embind.** Every program on emscripten links `-lembind`, which
`/webcpp/trystero//trystero` adds as a linker flag: `on`, b2's own
feature, is not free, and b2 ignores it among usage requirements.
@@ -278,6 +289,15 @@ holds only what is specific to trystero.
while another room pings; (9) a held handshake frame recovering in both
id orders with no false password report. Crossed adoption races allow
retries but fail by connection count above four constructions per side.
+ - Recovered-peer relay scenarios wait for fresh, currently joined peers on
+ both sides within the existing 30 s setup bound, then require a fresh
+ round-trip message before injecting a relay fault. A join reported by one
+ side alone does not prove the other's handshake completed. The controlled
+ `delayNextRecovery` fixture delays one outbound direction of the first
+ recovered channel for 12 s, beyond the C++ handshake deadline; a subsequent
+ connection must complete the setup. A departure after the relay fault
+ still fails. Console errors remain fatal, with RTCError fields recorded
+ alongside peer events so a failure is not reduced to `OperationError`.
- Every peer gathers its ICE candidates on the machine alone: the C++
peers get `stun:127.0.0.1:9`, where nothing answers, in place of
Trystero's public STUN servers, the native peer binds its connections to
diff --git a/README.md b/README.md
index 08d8dab..7bec36d 100644
--- a/README.md
+++ b/README.md
@@ -64,16 +64,16 @@ send a wrong room proof, reported by the lower id only.
## Building inside the superproject
trystero is developed inside the webcpp superproject, as a Boost library is
-developed inside Boost. Besides Boost, it needs three libraries that are not
-part of it, until webcpp builds them from `third_party/`:
+developed inside Boost. Its TLS and WebRTC dependencies are built from
+pinned sources; only libsecp256k1 needs an external installation:
| Library | Needed by | Found where |
| --- | --- | --- |
| libsecp256k1 0.8.0, with its `schnorrsig` and `extrakeys` modules | every room: it signs the Nostr events peers meet through | `-sSECP256K1_ROOT=` natively, `-sSECP256K1_EMSCRIPTEN_ROOT=` for its emscripten build, else `.local/secp256k1-native` and `.local/secp256k1-emscripten` |
-| libdatachannel 0.24.6 | the native backend | `-sLIBDATACHANNEL_ROOT=`, else `.local/libdatachannel` |
-| OpenSSL 3 | the native backend | `-sOPENSSL_ROOT=`, else `.local/openssl` |
+| libdatachannel 0.24.6 | the native backend | `/webcpp/third_party//libdatachannel`, from pinned source submodules |
+| OpenSSL 3.5.9 | the native backend | `/webcpp/third_party//openssl`, also used by Asio and Beast |
-Each `-s`, on b2's command line, names a directory with the library's
+The libsecp256k1 `-s` option, on b2's command line, names a directory with the library's
`include/` and `lib/`; the environment is never read. Without it, the library
is looked for in the superproject's `.local/` directory the table names,
where webcpp's CI installs it, and else, natively outside Windows, in
@@ -95,7 +95,7 @@ project uses the rooms and the browser backend through
libsecp256k1 and Boost.JSON's definitions, compiled once per variant, and on
emscripten embind and `BOOST_ASIO_DISABLE_THREADS`. A native program uses
`/webcpp/trystero//native`, which adds libdatachannel and OpenSSL, and
-declares `on` itself, as `example/Jamfile` does: b2 lets
+declares `multi` and `on` itself, as `example/Jamfile` does: b2 lets
no usage requirement override a build's `exception-handling=off`.
## The examples
@@ -189,7 +189,7 @@ struct application {
```
webcpp.link native_quick_start : native_quick_start.cpp
- : /webcpp/trystero//native on : native ;
+ : /webcpp/trystero//native multi on : native ;
```
@@ -212,11 +212,11 @@ says otherwise.
### 1. Install the tools
-git, CMake, clang (the Xcode command line tools), Python 3, Node, OpenSSL 3,
-Boost 1.92 and b2:
+git, CMake 3.21 or newer, clang (the Xcode command line tools), Python 3,
+Node, Perl, Make, Boost 1.92 and b2:
```sh
-brew install cmake openssl@3 boost boost-build node
+brew install cmake boost boost-build node
```
### 2. Create a workspace
@@ -262,28 +262,22 @@ cmake --build build-secp256k1-native && cmake --install build-secp256k1-native
cmake --build build-secp256k1-emscripten && cmake --install build-secp256k1-emscripten
```
-### 6. Build libdatachannel
+### 6. Initialize the native dependencies
-libdatachannel's CMake finds OpenSSL where `OPENSSL_ROOT_DIR` says, which
-Homebrew's OpenSSL needs, and the build where `webcpp/.local/openssl` links. It is built with the compiler that builds the
-programs, clang: a program built with GCC and libstdc++ does not link against
-a libdatachannel built with libc++.
+The recursive checkout already includes pinned OpenSSL, libdatachannel,
+libjuice, usrsctp, plog and libsrtp sources. For an existing checkout:
```sh
-openssl=$(brew --prefix openssl@3)
-ln -s "$openssl" webcpp/.local/openssl
-
-git clone --recurse-submodules --branch v0.24.6 \
- https://github.com/paullouisageneau/libdatachannel.git
-cmake -S libdatachannel -B build-libdatachannel -DCMAKE_BUILD_TYPE=Release \
- -DNO_WEBSOCKET=ON -DNO_EXAMPLES=ON -DNO_TESTS=ON -DOPENSSL_ROOT_DIR=$openssl \
- -DCMAKE_INSTALL_PREFIX=$PWD/webcpp/.local/libdatachannel
-cmake --build build-libdatachannel && cmake --install build-libdatachannel
+git -C webcpp submodule update --init --recursive third_party/libs/openssl third_party/libs/libdatachannel
```
-The three libraries are now where the build looks for them, in
-`webcpp/.local/`, which git ignores: no variable is needed, in this terminal
-or another.
+B2 builds them with the selected compiler, runtime and C++ ABI when the
+native backend is first needed. Each upstream checkout remains unchanged.
+The generated headers and static archives are kept together by build
+configuration. Asio, Beast and Trystero share one OpenSSL provider in a
+combined application; no system OpenSSL or installed libdatachannel is used.
+Native Trystero targets declare `multi` because WebRTC runs
+worker threads. The supplied examples and tests declare it already.
### 7. Tell b2 its compilers and Boost
diff --git a/build.jam b/build.jam
index 1cda839..6bc8db5 100644
--- a/build.jam
+++ b/build.jam
@@ -10,33 +10,16 @@
project /webcpp/trystero ;
-# libsecp256k1, libdatachannel and OpenSSL, which webcpp does not build
-# until it builds them from third_party/, are found where
-# -sSECP256K1_ROOT=, -sSECP256K1_EMSCRIPTEN_ROOT=,
-# -sLIBDATACHANNEL_ROOT= and -sOPENSSL_ROOT= on b2's command line
-# say, a relative one from b2's working directory, else in the
-# superproject's .local/, where webcpp's CI installs them, else, natively
-# outside Windows, in /usr/include or /usr/local/include, where a system
-# install is legitimate (webcpp.external and webcpp.external-found). The
-# environment is never read. When none holds a library, trystero is left
-# out, with one message that names it, unless the build gives
-# webcpp-require-external=on, as the CI does, which stops it instead.
+# Only libsecp256k1 is externally installed. Native WebRTC and OpenSSL are
+# pinned source dependencies, built together for the consumer's B2 variant.
+import errors ;
import webcpp ;
-# MSVC's names are CMake's there: libsecp256k1.lib, and OpenSSL's libssl.lib
-# and libcrypto.lib, which an installation of Shining Light Productions, as
-# GitHub's Windows images have, keeps in lib/VC/x64/MD. A static
-# libsecp256k1 on Windows needs SECP256K1_STATIC, or its header declares
-# every function imported from a DLL.
# tag::dependencies[]
local secp256k1-root = [ webcpp.external trystero : libsecp256k1
: SECP256K1_ROOT : secp256k1-native : secp256k1.h : native ] ;
local secp256k1-emscripten-root = [ webcpp.external trystero : libsecp256k1
: SECP256K1_EMSCRIPTEN_ROOT : secp256k1-emscripten : secp256k1.h : emscripten ] ;
-local libdatachannel-root = [ webcpp.external trystero : libdatachannel
- : LIBDATACHANNEL_ROOT : libdatachannel : rtc/rtc.hpp : native ] ;
-local openssl-root = [ webcpp.external trystero : OpenSSL : OPENSSL_ROOT : openssl
- : openssl/ssl.h : native ] ;
lib secp256k1 : : secp256k1 emscripten
$(secp256k1-emscripten-root)/lib
: : $(secp256k1-emscripten-root)/include ;
@@ -45,24 +28,8 @@ lib secp256k1 : : libsecp256k1 msvc
: : $(secp256k1-root)/include SECP256K1_STATIC ;
lib secp256k1 : : secp256k1 $(secp256k1-root)/lib
: : $(secp256k1-root)/include ;
-lib datachannel : : datachannel $(libdatachannel-root)/lib
- : : $(libdatachannel-root)/include
- $(libdatachannel-root)/lib ;
-lib ssl : : libssl msvc $(openssl-root)/lib
- $(openssl-root)/lib/VC/x64/MD
- : : $(openssl-root)/include ;
-lib ssl : : ssl $(openssl-root)/lib
- : : $(openssl-root)/include ;
-lib crypto : : libcrypto msvc $(openssl-root)/lib
- $(openssl-root)/lib/VC/x64/MD
- : : $(openssl-root)/include ;
-lib crypto : : crypto $(openssl-root)/lib
- : : $(openssl-root)/include ;
-# Searched libraries, used only through : built as dependencies, with
-# the properties of what uses them. Requested alone, by b2 at the
-# superproject's root or b2 libs/trystero, their alternatives would be matched
-# against a request without the 20 each inherits, and none chosen.
-explicit secp256k1 datachannel ssl crypto ;
+# Searched libraries are used only through usage requirements.
+explicit secp256k1 ;
# end::dependencies[]
# The dependencies of the rooms: libsecp256k1, the emscripten build of it on
@@ -76,8 +43,10 @@ rule trystero-dependencies ( properties * )
# uses it is built.
rule native-dependencies ( properties * )
{
- return [ webcpp.external-found trystero : libdatachannel OpenSSL
- : $(properties) ] ;
+ if single in $(properties)
+ {
+ errors.user-error "Trystero's native backend uses worker threads. Add multi to the consuming target or pass threading=multi." ;
+ }
}
# On emscripten, the browser has no threads (the event loop drives Asio), and
@@ -100,5 +69,5 @@ alias trystero : : @trystero-dependencies
# a build's exception-handling=off.
# tag::native[]
alias native : : @native-dependencies
- : : trystero datachannel ssl crypto ;
+ : : trystero /webcpp/third_party//libdatachannel ;
# end::native[]
diff --git a/doc/Jamfile b/doc/Jamfile
index 4f6032c..3ac1a63 100644
--- a/doc/Jamfile
+++ b/doc/Jamfile
@@ -15,5 +15,5 @@ webcpp.doc trystero : trystero.adoc ;
# brings libdatachannel and OpenSSL, and the browser build's define of
# build.jam, which a requirement conditioned on the emscripten toolset does
# not give it.
-webcpp.reference trystero : /webcpp/trystero//native
+webcpp.reference trystero : /webcpp/trystero//native multi
/webcpp//emscripten-reference BOOST_ASIO_DISABLE_THREADS ;
diff --git a/doc/building.adoc b/doc/building.adoc
index 6d386b8..7175d46 100644
--- a/doc/building.adoc
+++ b/doc/building.adoc
@@ -8,10 +8,9 @@
== Building
trystero is header-only, and is developed inside the webcpp superproject, as
-a Boost library is developed inside Boost. Besides Boost, it needs three
-libraries that are not part of it, which the build finds where b2's command
-line says, else in the superproject's `.local/`, until webcpp builds them
-from `third_party/`:
+a Boost library is developed inside Boost. Its native TLS and WebRTC
+dependencies are built from pinned sources. Only libsecp256k1 needs an
+external installation:
[cols="2,2,3",options="header"]
|===
@@ -25,14 +24,14 @@ from `third_party/`:
| libdatachannel 0.24.6
| the native backend
-| `-sLIBDATACHANNEL_ROOT=`, else `.local/libdatachannel`
+| `/webcpp/third_party//libdatachannel`, built from `third_party/libs/libdatachannel`
-| OpenSSL 3
+| OpenSSL 3.5.9
| the native backend
-| `-sOPENSSL_ROOT=`, else `.local/openssl`
+| `/webcpp/third_party//openssl`, shared by the Asio, Beast and Trystero build graphs
|===
-Each `-s` names a directory with the library's `include/` and `lib/`, on b2's
+The libsecp256k1 `-s` option names a directory with the library's `include/` and `lib/`, on b2's
command line; the environment is never read, so that a variable a shell keeps
from another day never replaces `.local/` without a word. Without it, the
library is looked for in the directory of `.local/` that the table names,
@@ -44,11 +43,9 @@ header stops the build, naming it. A library found nowhere leaves trystero
out: its tests and examples are skipped, the build says so once, naming the
library and where it looked, and every other library builds; with
`webcpp-require-external=on`, as the continuous integration builds, it stops
-the build instead. With MSVC, the libraries are CMake's
-`libsecp256k1.lib`, which a program links statically with `SECP256K1_STATIC`
-defined, and OpenSSL's `libssl.lib` and `libcrypto.lib`, also looked for in
-`lib/VC/x64/MD`, where the installer of Shining Light Productions puts them.
-trystero's `build.jam` declares them so:
+the build instead. With MSVC, libsecp256k1 uses CMake's
+`libsecp256k1.lib`, linked statically with `SECP256K1_STATIC` defined.
+trystero's `build.jam` declares that external dependency so:
[listing]
----
@@ -74,14 +71,18 @@ embind is linked as a flag, `-lembind`, rather than with b2's own
free among usage requirements, so a program that used it would not link.
A native program uses `/webcpp/trystero//native`, which adds libdatachannel
-and OpenSSL:
+and the same source-built OpenSSL used by Asio and Beast:
[listing]
----
include::{library-root}/build.jam[tag=native]
----
-The native backend's WebRTC needs exceptions (<>),
+The native backend uses worker threads, so each consumer declares
+`multi`. Its OpenSSL dependency is the matching threaded variant;
+a single-threaded native backend is rejected before compilation.
+
+The native backend's WebRTC also needs exceptions (<>),
and b2 lets no usage requirement override a build's
`exception-handling=off`, so each program and test that uses it declares
`on` itself, as the examples do:
@@ -119,7 +120,7 @@ include::{webcpp-root}/tools/ci/emsdk.jam[tag=emsdk]
include::{webcpp-root}/tools/ci/emsdk.jam[tag=emscripten]
----
-With it and the three libraries found, from the root of a webcpp checkout,
+With it, libsecp256k1 installed and the pinned source submodules initialized, from the root of a webcpp checkout,
these build the tests and the examples, natively and on emscripten:
[source,bash]
@@ -129,7 +130,7 @@ b2 toolset=emscripten libs/trystero/test libs/trystero/example
----
[#trystero-building-dependencies]
-=== The three libraries
+=== Preparing the dependencies
libsecp256k1 is built twice: natively, and with Emscripten for the browser.
Its small tables keep the browser's download small:
@@ -155,27 +156,27 @@ cmake --build build-secp256k1-emscripten && cmake --install build-secp256k1-emsc
where `webcpp` is the checkout of the superproject: each is installed in the
directory of `.local/` where the build looks for it.
-libdatachannel is built with the compiler and the standard library that
-build the programs: a program built with GCC and `libstdc{plus}{plus}` does
-not link against a libdatachannel built with `libc{plus}{plus}`, though the
-native headers still compile alone. Its own WebSocket is not used, so it is
-built without it, and its CMake finds OpenSSL where `OPENSSL_ROOT_DIR` says,
-which Homebrew's OpenSSL needs, and which `.local/openssl` links for the build
-too:
+Initialize the native dependencies from the superproject root:
[source,bash]
----
-openssl=$(brew --prefix openssl@3) # or wherever OpenSSL 3 is
-ln -s "$openssl" webcpp/.local/openssl
-
-git clone --recurse-submodules --branch v0.24.6 \
- https://github.com/paullouisageneau/libdatachannel.git
-cmake -S libdatachannel -B build-libdatachannel -DCMAKE_BUILD_TYPE=Release \
- -DNO_WEBSOCKET=ON -DNO_EXAMPLES=ON -DNO_TESTS=ON -DOPENSSL_ROOT_DIR=$openssl \
- -DCMAKE_INSTALL_PREFIX=$PWD/webcpp/.local/libdatachannel
-cmake --build build-libdatachannel && cmake --install build-libdatachannel
+git submodule update --init --recursive third_party/libs/openssl third_party/libs/libdatachannel
----
+Install CMake 3.21 or newer, Perl and Make (native Windows Perl and nmake
+with MSVC). B2 builds OpenSSL, libdatachannel and its pinned nested
+libjuice, usrsctp and libsrtp sources for the configured compiler, standard
+library, runtime and build variant. Upstream sources are verified and
+copied to a disposable build directory; the checkout is never patched.
+The resulting headers and separate static archives stay in B2's variant
+directory, and the final link contains exactly one OpenSSL archive pair.
+
+libdatachannel's own WebSocket, examples and tests are disabled; media
+transport remains enabled. System OpenSSL and installed libdatachannel
+binaries are never fallback providers. A combined Asio/Beast/Trystero
+application uses the same native `multi` configuration for all
+three libraries.
+
[#trystero-building-examples]
=== Running the examples
diff --git a/doc/changelog.adoc b/doc/changelog.adoc
index 3b1374c..65033fe 100644
--- a/doc/changelog.adoc
+++ b/doc/changelog.adoc
@@ -22,6 +22,12 @@ of every version are on webcpp's index page.
=== webcpp 0.1.0
// tag::0.1.0[]
+* Fixed native multiroom handoffs losing early presence frames, and
+ negotiations stalled by a channel closing before room binding.
+* Changed the native backend to build pinned libdatachannel sources and their
+dependencies through B2, sharing source-built OpenSSL with Asio and Beast.
+* Changed native builds to require `threading=multi`; the backend uses workers.
+* Fixed GCC compilation of native WebSocket coroutine callbacks.
* Changed room construction to `app::join`, sharing connections between rooms.
* *Breaking change:* Removed `room_config`; construct `app` and use `join`
with `app_config` and `room_options`.
diff --git a/doc/native.adoc b/doc/native.adoc
index 0938507..dde013c 100644
--- a/doc/native.adoc
+++ b/doc/native.adoc
@@ -58,6 +58,21 @@ transfers assemble their buffer in the room's resource. A text message, as a pee
send, or a binary one larger than any room frame, is dropped on
libdatachannel's thread: neither can be a frame.
+Valid binary frames that arrive before the message handler is installed wait
+in a FIFO in the app's resource. The queue holds at most 64 frames for at most
+10 seconds from its first frame. Overflow or expiry closes the channel;
+closing or destroying it discards the pending frames. The existing native
+timer invalidates an expiry already queued when the queue drains or closes.
+Installing a receiver posts delivery on the executor with the app's
+allocator. It never calls the receiver inline, and delivery checks the current
+handler and channel before each frame, so a handler may replace itself or
+close the channel. A message already queued ahead of that delivery drains
+older frames first when a receiver is available.
+
+If a transport closes during adoption, before the room obtains a binding,
+the room forgets that negotiation and restarts announcements. Its later close
+event cannot leave signaling marked connected with no binding.
+
[#trystero-native-libdatachannel]
=== What the backend asks of libdatachannel
diff --git a/doc/roadmap.adoc b/doc/roadmap.adoc
index b7ef226..be5ef58 100644
--- a/doc/roadmap.adoc
+++ b/doc/roadmap.adoc
@@ -21,7 +21,7 @@ echoes the offerer's `msid` into the answer.
. *Trystero's other features.* Request actions (`kind: 'request'`),
decisions on incoming transfers and their progress, the application's own
handshake, passive rooms, and the other strategies, among them MQTT and BitTorrent trackers.
-. *The external libraries from webcpp's own build.* libsecp256k1,
-libdatachannel and OpenSSL are found where b2's command line or the
-superproject's `.local/` says until webcpp builds them from `third_party/`
+. *libsecp256k1 from webcpp's own build.* libsecp256k1 is still found where
+b2's command line or the superproject's `.local/` says. Native OpenSSL and
+libdatachannel already build from pinned `third_party/` sources
(<>).
diff --git a/doc/testing.adoc b/doc/testing.adoc
index b6c681c..bfb19d3 100644
--- a/doc/testing.adoc
+++ b/doc/testing.adoc
@@ -124,7 +124,10 @@ include::{library-root}/test/Jamfile[tag=allocation]
| `native_peer_connection`, `native_room`
| Two libdatachannel connections wired to each other, each handler on the
executor, and whole native rooms over real libdatachannel connections,
- bound to 127.0.0.1.
+ bound to 127.0.0.1. A controlled executor holds real channel callbacks to
+ prove pre-handler FIFO delivery, a 65th message ahead of the posted flush,
+ handler replacement and destruction, the 64-frame and 10-second bounds,
+ and allocation and release through the channel's resource.
| `browser_event_loop`, `browser_websocket`, `browser_websocket_bound`, `browser_websocket_late_events`, `browser_sealer`, `browser_data_channel`, `browser_peer_connection`
| The browser backend, on emscripten under node, which has the page's
@@ -259,18 +262,30 @@ and run the unit tests with GCC 14 and with clang 18 against
`libstdc{plus}{plus}` in a Linux container, Ubuntu 24.04, with `docker run`
and the network `none`, which leaves the loopback alone: every test passes,
which shows that none reaches beyond the machine
-(<>). libsecp256k1 and libdatachannel are
-built before, on the runner, Ubuntu 24.04 too, with the lane's compiler
-against the runner's OpenSSL 3, and the container, which holds the same
-compilers and OpenSSL's development files, sees them where the runner put
-them.
+(<>). libsecp256k1 is installed before
+running the container. B2 builds the pinned OpenSSL, libdatachannel and
+nested source dependencies inside the container with the lane's compiler,
+runtime and static link configuration. These builds need no network access.
+
+[#trystero-testing-provider]
+=== The common OpenSSL provider
+
+The native `provider-integration` lane builds and runs one application that
+uses Asio TLS, Beast and Trystero's native backend together. It compares the
+compiled OpenSSL version with the loaded implementation and constructs TLS
+and WebRTC state. The run is bounded to 45 seconds and uses the threaded
+release profile. The superproject's source dependency tests also check that
+the final Unix executable has no dynamic OpenSSL or libdatachannel provider,
+that each static archive occurs once and that dependent archives precede
+OpenSSL in the link order.
[#trystero-testing-report]
=== The test matrix
The continuous integration runs trystero's tests in lanes, one toolset each,
and its own lanes, the oracle once and the interop natively and on
-emscripten, as `native.trystero.interop` and `emscripten.trystero.interop`.
+emscripten, as `native.trystero.interop` and `emscripten.trystero.interop`, plus the
+native `provider-integration` lane for the common TLS provider.
Each lane builds from scratch and records what b2 built and ran; webcpp's
`tools/report/report.py` merges the files of every lane into a matrix, where
each cell says whether that program passed in that lane, or how it failed.
diff --git a/example/Jamfile b/example/Jamfile
index f8a89fe..3b5593f 100644
--- a/example/Jamfile
+++ b/example/Jamfile
@@ -18,7 +18,7 @@ webcpp.targets native emscripten ;
# reports errors by throwing.
# tag::native[]
webcpp.link native_quick_start : native_quick_start.cpp
- : /webcpp/trystero//native on : native ;
+ : /webcpp/trystero//native multi on : native ;
# end::native[]
# tag::browser[]
webcpp.link quick_start : quick_start.cpp
diff --git a/include/webcpp/trystero/native/backend.hpp b/include/webcpp/trystero/native/backend.hpp
index bf3d73e..e8a42c8 100644
--- a/include/webcpp/trystero/native/backend.hpp
+++ b/include/webcpp/trystero/native/backend.hpp
@@ -14,13 +14,12 @@
#include
#include
#include
+#include
#include
#include
#include // lint-world: posts handlers only
-#include // lint-world: posts handlers only
#include // lint-world: the relays' TLS
-#include // lint-world: Trystero's timers
#include
#include
@@ -38,63 +37,6 @@
*/
namespace webcpp::trystero::native {
-/**
- * An Asio timer whose waits are allocated in the room's resource.
- *
- * Tip: Asio cannot take back an expiry it has already queued, which it then completes as a
- * success; so each wait carries its number, and `cancel`, a later `start` and the destructor end
- * it, by changing the number or freeing it, before its handler runs.
- *
- * @see "The native backend", in the guide.
- */
-class timer : public trystero::backend::timer {
-public:
- /**
- * Constructs a timer, not started.
- *
- * @param ex The executor it fires on.
- * @param memory The room's resource, which each wait is allocated in; it must outlive the
- * timer's pending waits.
- */
- timer(const boost::asio::any_io_executor& ex, std::pmr::memory_resource* memory)
- : timer_(ex),
- memory_(memory),
- waits_(
- std::allocate_shared(std::pmr::polymorphic_allocator<>(memory), 0)) {}
-
- /**
- * Calls `fire` on the executor once `delay` has passed, in place of a pending expiry.
- *
- * @param delay How long to wait.
- * @param fire What to call when the timer expires; never called once the timer is cancelled,
- * started again or destroyed, even when its expiry was already queued.
- */
- void start(std::chrono::milliseconds delay, handler fire) override {
- const std::uint64_t wait = ++*waits_;
- timer_.expires_after(delay);
- timer_.async_wait(boost::asio::bind_allocator(
- std::pmr::polymorphic_allocator<>(memory_),
- [waits = std::weak_ptr(waits_), wait,
- fire = std::move(fire)](boost::system::error_code ec) mutable {
- if (const auto current = waits.lock(); !ec && current && *current == wait) {
- fire();
- }
- }));
- }
-
- /** Cancels the pending expiry, if any, whose handler is then never called. */
- void cancel() override {
- ++*waits_;
- timer_.cancel();
- }
-
-private:
- boost::asio::steady_timer timer_; // lint-world: Trystero's timers
- std::pmr::memory_resource* memory_;
- // The number of the wait under way: a handler that finds another, or none, does nothing.
- std::shared_ptr waits_;
-};
-
// The factory makes peer connections over libdatachannel, which need exceptions: without them
// (WEBCPP_TRYSTERO_NO_EXCEPTIONS) it does not exist, and the timer, the sealer and the WebSockets
// remain.
diff --git a/include/webcpp/trystero/native/data_channel.hpp b/include/webcpp/trystero/native/data_channel.hpp
index b4d1a6f..b4f521c 100644
--- a/include/webcpp/trystero/native/data_channel.hpp
+++ b/include/webcpp/trystero/native/data_channel.hpp
@@ -15,13 +15,18 @@
#ifndef WEBCPP_TRYSTERO_NO_EXCEPTIONS
#include
+#include
#include
#include // lint-world: posts handlers only
+#include // lint-world: allocates the pending-frame flush
#include // lint-world: posts handlers only
#include