The entry quic_echo
The source src/modules/demonstrations/quic_echo built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
A QUIC echo server: QUIC in the process, over a datagram endpoint with a listen grant of UDP. The design: QUIC: QUIC on the network (the fourth layer, built, with Retry and the budgets of work), and src/library/modus/quic. A client opens up to STREAMS_PER_CONNECTION streams at one time; on each one the server writes back each byte that it reads, then ends the stream after the client ended it, or resets it after the client reset it.
What it can reach comes from its grants only:
a datagram endpoint with a listen grant: the UDP port 4433, and the
remotes that send a datagram of 1200 bytes to it;
the module cryptography, through its import slots.
The key of the server: an Ed25519 key that this process makes at its start from its own generator (fill_for_a_key, the strength "processor" at least). Its public key goes on the log and in the window: a client pins it. The private key stays in the memory of this process; a new start makes a new key. A seed weaker than "processor" makes no key: the process says so in its window, and listens on nothing.
What it is for. It is the test bench of the QUIC library on a real network path: the handshake of TLS 1.3, streams in both directions, Retry, the budgets of work against a hostile client, and the idle end. Its echo has no other use: the peer of the modus tool writes a pattern on each stream and checks each byte that comes back. The service remote uses the same library and the same limits.
Start: start("quic_echo") in the console, or the bar of the desktop. A client needs the public key from the log or the window.
Grants, as the root service gives them:
- Network: a listen grant of UDP on port 4433. The network service admits a new remote only on a datagram of 1200 bytes or more, and holds the limit of three times the bytes that came from it.
It needs no other grant: the cryptography is the module cryptography, which the loader gives through the imports of this process.
What a reader sees: a window with the key and the counts of the server. The log has "quic_echo: the public key of this server: ...", "quic_echo: listening on the UDP port 4433, ...", one line for each connection that starts and ends, a line on each idle end that says if it held its bound, and the counters of the server when they change: the connections accepted and ended, the Retries, the Initials refused by each limit, the datagrams over the budget.
What it does not prove: the client is the peer of the modus tool, not a QUIC stack of another project. 0-RTT and the migration of a connection are not built.
main.odin: the endpoint, the server and the loop. draw.odin: the window.
See: QUIC: What is not built, and will not be in version 1 of this library
quic_echo module with an entry
- Hash
76ec64e2d4b0ac422b2a418a6cca225ff69c851bdae07fb05c69e686c152cbf3- Size
300495 bytes- Exports
0- Imports
2- Imported by
0- License
- MIT
A QUIC echo server: QUIC in the process, over a datagram endpoint with a listen grant of UDP
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/quic_echo |
| Boot image | yes: in the boot image, 300495 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
entry() | The entry of quic_echo: it makes its key, checks its grant, then runs the QUIC server until the machine stops |
entry
entry()
The entry of quic_echo: it makes its key, checks its grant, then runs the QUIC server until the machine stops.
The entry, in order:
- 1. takes its random generator (with no seed it stops:
fail) and opens its window; - 2. makes its Ed25519 key. With a seed under the strength "processor" it writes "quic_echo: the random seed of this process is weak: ..." and then only draws its window;
- 3. writes the public key on the log;
- 4. opens its endpoint and its datagram region, and asks the network service for its grant; a grant that is not a listen grant of UDP stops it;
- 5. maps the table of the connections and their streams, and starts the QUIC server;
- 6. writes "quic_echo: listening on the UDP port 4433, ...".
Then one loop runs for ever. Each pass gives the datagrams that arrived to the server, which echoes the bytes of each stream, and draws the window at most ten times in one second. It waits for a datagram, an event of the window, the next deadline of QUIC, or one second.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/quic_echo/main.odin:376
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | A listen grant of UDP: QUIC in the process, the module cryptography through its imports. | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| 16 QUIC connections of about 85 KiB each, 4 streams of about 130 KiB for each, and an echo buffer of 16 KiB for each stream: about 2770 pages, in one mapping of the process: 3667 pages. And the glyph memory of the copy of the text rendering of the drawing module, which draws its text: 354 pages (display.TEXT_MEMORY_PAGES). 3667 + 354 = 4021. See: QUIC: QUIC on the network (the fourth layer, built, with Retry and the budgets of work) |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
