raiha 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/LICENSE +202 -0
- data/README.md +94 -22
- data/docs/configuration.md +227 -0
- data/docs/development.md +99 -0
- data/docs/fiber-scheduler.md +591 -0
- data/docs/getting-started.md +190 -0
- data/docs/http3-client.md +303 -0
- data/docs/http3-server.md +301 -0
- data/docs/platforms.md +98 -0
- data/docs/qlog.md +86 -0
- data/docs/quic.md +268 -0
- data/docs/threads.md +127 -0
- data/examples/_certificate.rb +55 -0
- data/examples/high_level_loopback.rb +59 -0
- data/examples/http3_get_public.rb +68 -0
- data/examples/in_memory_handshake.rb +38 -0
- data/examples/qlog_output.rb +58 -0
- data/examples/qlog_roundtrips.rb +66 -0
- data/examples/quic_gem_loopback.rb +62 -0
- data/examples/stream_echo.rb +68 -0
- data/examples/udp_handshake.rb +76 -0
- data/lib/raiha/http3/action.rb +21 -0
- data/lib/raiha/http3/capsule.rb +86 -0
- data/lib/raiha/http3/connection.rb +983 -0
- data/lib/raiha/http3/error.rb +24 -0
- data/lib/raiha/http3/error_code.rb +27 -0
- data/lib/raiha/http3/event.rb +63 -0
- data/lib/raiha/http3/frame.rb +148 -0
- data/lib/raiha/http3/frame_reader.rb +114 -0
- data/lib/raiha/http3/message.rb +137 -0
- data/lib/raiha/http3/output.rb +61 -0
- data/lib/raiha/http3/priority.rb +52 -0
- data/lib/raiha/http3/qlog.rb +145 -0
- data/lib/raiha/http3/qpack/decoder.rb +302 -0
- data/lib/raiha/http3/qpack/dynamic_table.rb +83 -0
- data/lib/raiha/http3/qpack/encoder.rb +94 -0
- data/lib/raiha/http3/qpack/error.rb +39 -0
- data/lib/raiha/http3/qpack/error_code.rb +13 -0
- data/lib/raiha/http3/qpack/field.rb +15 -0
- data/lib/raiha/http3/qpack/huffman.rb +397 -0
- data/lib/raiha/http3/qpack/reader.rb +82 -0
- data/lib/raiha/http3/qpack/result.rb +26 -0
- data/lib/raiha/http3/qpack/static_table.rb +139 -0
- data/lib/raiha/http3/qpack/writer.rb +44 -0
- data/lib/raiha/http3/qpack.rb +26 -0
- data/lib/raiha/http3/receiving.rb +46 -0
- data/lib/raiha/http3/sending.rb +23 -0
- data/lib/raiha/http3/session.rb +31 -0
- data/lib/raiha/http3/settings.rb +81 -0
- data/lib/raiha/http3/structured_field.rb +120 -0
- data/lib/raiha/http3/tracer.rb +26 -0
- data/lib/raiha/http3/varint.rb +45 -0
- data/lib/raiha/http3.rb +19 -0
- data/lib/raiha/http3_binding.rb +139 -0
- data/lib/raiha/namespace.rb +11 -0
- data/lib/raiha/quic/config.rb +229 -0
- data/lib/raiha/quic/congestion/algorithms.rb +17 -0
- data/lib/raiha/quic/congestion/cubic.rb +258 -0
- data/lib/raiha/quic/congestion/new_reno.rb +161 -0
- data/lib/raiha/quic/congestion/pacing.rb +21 -0
- data/lib/raiha/quic/congestion/startup/rapid_start.rb +249 -0
- data/lib/raiha/quic/congestion/startup.rb +13 -0
- data/lib/raiha/quic/congestion.rb +15 -0
- data/lib/raiha/quic/connection.rb +2022 -0
- data/lib/raiha/quic/connection_ids.rb +62 -0
- data/lib/raiha/quic/crypto/aead.rb +68 -0
- data/lib/raiha/quic/crypto/header_protection.rb +42 -0
- data/lib/raiha/quic/crypto/initial.rb +23 -0
- data/lib/raiha/quic/crypto/keys.rb +32 -0
- data/lib/raiha/quic/crypto/mac.rb +15 -0
- data/lib/raiha/quic/crypto/random.rb +13 -0
- data/lib/raiha/quic/crypto.rb +18 -0
- data/lib/raiha/quic/crypto_stream.rb +161 -0
- data/lib/raiha/quic/datagrams.rb +91 -0
- data/lib/raiha/quic/endpoint.rb +785 -0
- data/lib/raiha/quic/error.rb +61 -0
- data/lib/raiha/quic/error_code.rb +34 -0
- data/lib/raiha/quic/event.rb +59 -0
- data/lib/raiha/quic/issued_connection_ids.rb +137 -0
- data/lib/raiha/quic/kept_packets.rb +41 -0
- data/lib/raiha/quic/mtu_search.rb +75 -0
- data/lib/raiha/quic/negotiation.rb +143 -0
- data/lib/raiha/quic/new_token.rb +55 -0
- data/lib/raiha/quic/pacer.rb +52 -0
- data/lib/raiha/quic/packet_protection.rb +310 -0
- data/lib/raiha/quic/path.rb +473 -0
- data/lib/raiha/quic/peer_connection_ids.rb +160 -0
- data/lib/raiha/quic/qlog.rb +260 -0
- data/lib/raiha/quic/ranges.rb +32 -0
- data/lib/raiha/quic/recovery/duty.rb +102 -0
- data/lib/raiha/quic/recovery/packet_number_space.rb +420 -0
- data/lib/raiha/quic/recovery/rate_meter.rb +95 -0
- data/lib/raiha/quic/recovery/rtt_estimator.rb +57 -0
- data/lib/raiha/quic/recovery/sent_packet.rb +16 -0
- data/lib/raiha/quic/recovery.rb +641 -0
- data/lib/raiha/quic/remembered_transport_parameters.rb +29 -0
- data/lib/raiha/quic/retry_token.rb +54 -0
- data/lib/raiha/quic/route.rb +37 -0
- data/lib/raiha/quic/scheduler.rb +112 -0
- data/lib/raiha/quic/session.rb +47 -0
- data/lib/raiha/quic/stateless_reset.rb +38 -0
- data/lib/raiha/quic/stats.rb +24 -0
- data/lib/raiha/quic/streams/receive_window.rb +119 -0
- data/lib/raiha/quic/streams/receiver.rb +217 -0
- data/lib/raiha/quic/streams/sender.rb +200 -0
- data/lib/raiha/quic/streams.rb +687 -0
- data/lib/raiha/quic/test/bottleneck.rb +55 -0
- data/lib/raiha/quic/test/congestion_contract.rb +106 -0
- data/lib/raiha/quic/test/network.rb +244 -0
- data/lib/raiha/quic/test/random_loss.rb +34 -0
- data/lib/raiha/quic/test/reorder.rb +51 -0
- data/lib/raiha/quic/test/server.rb +54 -0
- data/lib/raiha/quic/test/vectors.rb +337 -0
- data/lib/raiha/quic/test/virtual_clock.rb +21 -0
- data/lib/raiha/quic/test.rb +17 -0
- data/lib/raiha/quic/tls_binding.rb +179 -0
- data/lib/raiha/quic/token.rb +28 -0
- data/lib/raiha/quic/tracer.rb +127 -0
- data/lib/raiha/quic/transmit.rb +14 -0
- data/lib/raiha/quic/transport_parameters.rb +244 -0
- data/lib/raiha/quic/version.rb +63 -0
- data/lib/raiha/quic/wire/codec.rb +136 -0
- data/lib/raiha/quic/wire/frame.rb +521 -0
- data/lib/raiha/quic/wire/header.rb +90 -0
- data/lib/raiha/quic/wire/packet.rb +130 -0
- data/lib/raiha/quic/wire/packet_number.rb +47 -0
- data/lib/raiha/quic/wire/retry.rb +62 -0
- data/lib/raiha/quic/wire/version_negotiation.rb +53 -0
- data/lib/raiha/quic/wire.rb +9 -0
- data/lib/raiha/quic.rb +46 -0
- data/lib/raiha/runtime/addresses.rb +35 -0
- data/lib/raiha/runtime/admission.rb +37 -0
- data/lib/raiha/runtime/client.rb +190 -0
- data/lib/raiha/runtime/driver.rb +165 -0
- data/lib/raiha/runtime/error.rb +16 -0
- data/lib/raiha/runtime/http3.rb +363 -0
- data/lib/raiha/runtime/http3_fields.rb +38 -0
- data/lib/raiha/runtime/http3_server.rb +416 -0
- data/lib/raiha/runtime/kept.rb +36 -0
- data/lib/raiha/runtime/qlog.rb +204 -0
- data/lib/raiha/runtime/rack.rb +180 -0
- data/lib/raiha/runtime/server.rb +334 -0
- data/lib/raiha/runtime/session.rb +447 -0
- data/lib/raiha/runtime/threaded/client.rb +161 -0
- data/lib/raiha/runtime/threaded/driver.rb +230 -0
- data/lib/raiha/runtime/threaded/http3.rb +287 -0
- data/lib/raiha/runtime/threaded/http3_server.rb +432 -0
- data/lib/raiha/runtime/threaded/server.rb +290 -0
- data/lib/raiha/runtime/threaded/session.rb +604 -0
- data/lib/raiha/runtime/threaded.rb +45 -0
- data/lib/raiha/runtime/udp.rb +410 -0
- data/lib/raiha/runtime/worker.rb +138 -0
- data/lib/raiha/runtime/workers.rb +248 -0
- data/lib/raiha/runtime.rb +37 -0
- data/lib/raiha/tls/anti_replay.rb +139 -0
- data/lib/raiha/tls/cipher_suite.rb +62 -0
- data/lib/raiha/tls/codec/error.rb +43 -0
- data/lib/raiha/tls/codec/reader.rb +95 -0
- data/lib/raiha/tls/codec/writer.rb +81 -0
- data/lib/raiha/tls/codec.rb +5 -0
- data/lib/raiha/tls/config.rb +318 -0
- data/lib/raiha/tls/crypto/aead.rb +64 -0
- data/lib/raiha/tls/crypto/certificate.rb +28 -0
- data/lib/raiha/tls/crypto/digest.rb +30 -0
- data/lib/raiha/tls/crypto/ecdh.rb +74 -0
- data/lib/raiha/tls/crypto/hash.rb +22 -0
- data/lib/raiha/tls/crypto/hkdf.rb +28 -0
- data/lib/raiha/tls/crypto/signature.rb +87 -0
- data/lib/raiha/tls/crypto.rb +19 -0
- data/lib/raiha/tls/error.rb +36 -0
- data/lib/raiha/tls/event.rb +45 -0
- data/lib/raiha/tls/extension/alpn.rb +35 -0
- data/lib/raiha/tls/extension/certificate_authorities.rb +35 -0
- data/lib/raiha/tls/extension/compress_certificate.rb +33 -0
- data/lib/raiha/tls/extension/cookie.rb +27 -0
- data/lib/raiha/tls/extension/early_data.rb +54 -0
- data/lib/raiha/tls/extension/key_share.rb +90 -0
- data/lib/raiha/tls/extension/list.rb +49 -0
- data/lib/raiha/tls/extension/opaque.rb +21 -0
- data/lib/raiha/tls/extension/placement.rb +55 -0
- data/lib/raiha/tls/extension/post_handshake_auth.rb +22 -0
- data/lib/raiha/tls/extension/pre_shared_key.rb +81 -0
- data/lib/raiha/tls/extension/psk_key_exchange_modes.rb +32 -0
- data/lib/raiha/tls/extension/record_size_limit.rb +30 -0
- data/lib/raiha/tls/extension/registry.rb +50 -0
- data/lib/raiha/tls/extension/server_name.rb +63 -0
- data/lib/raiha/tls/extension/signature_algorithms.rb +39 -0
- data/lib/raiha/tls/extension/signature_algorithms_cert.rb +21 -0
- data/lib/raiha/tls/extension/supported_groups.rb +32 -0
- data/lib/raiha/tls/extension/supported_versions.rb +53 -0
- data/lib/raiha/tls/extension.rb +32 -0
- data/lib/raiha/tls/handshake/acceptor.rb +164 -0
- data/lib/raiha/tls/handshake/authentication_messages.rb +127 -0
- data/lib/raiha/tls/handshake/certificate.rb +56 -0
- data/lib/raiha/tls/handshake/certificate_request.rb +39 -0
- data/lib/raiha/tls/handshake/certificate_verify.rb +40 -0
- data/lib/raiha/tls/handshake/client_hello.rb +208 -0
- data/lib/raiha/tls/handshake/client_hello_builder.rb +144 -0
- data/lib/raiha/tls/handshake/client_side.rb +578 -0
- data/lib/raiha/tls/handshake/conductor.rb +390 -0
- data/lib/raiha/tls/handshake/encrypted_extensions.rb +33 -0
- data/lib/raiha/tls/handshake/end_of_early_data.rb +28 -0
- data/lib/raiha/tls/handshake/finished.rb +36 -0
- data/lib/raiha/tls/handshake/key_update.rb +38 -0
- data/lib/raiha/tls/handshake/key_update_handling.rb +88 -0
- data/lib/raiha/tls/handshake/machine.rb +238 -0
- data/lib/raiha/tls/handshake/message.rb +25 -0
- data/lib/raiha/tls/handshake/new_session_ticket.rb +48 -0
- data/lib/raiha/tls/handshake/reassembler.rb +88 -0
- data/lib/raiha/tls/handshake/server_hello.rb +98 -0
- data/lib/raiha/tls/handshake/server_side.rb +672 -0
- data/lib/raiha/tls/handshake/violation.rb +12 -0
- data/lib/raiha/tls/handshake.rb +62 -0
- data/lib/raiha/tls/iana.rb +113 -0
- data/lib/raiha/tls/key_exchange.rb +58 -0
- data/lib/raiha/tls/key_schedule.rb +269 -0
- data/lib/raiha/tls/keylog.rb +40 -0
- data/lib/raiha/tls/keyring.rb +180 -0
- data/lib/raiha/tls/masked_inspect.rb +33 -0
- data/lib/raiha/tls/output.rb +32 -0
- data/lib/raiha/tls/profile.rb +82 -0
- data/lib/raiha/tls/record/layer.rb +228 -0
- data/lib/raiha/tls/record/protection.rb +67 -0
- data/lib/raiha/tls/record.rb +11 -0
- data/lib/raiha/tls/server_name.rb +42 -0
- data/lib/raiha/tls/session.rb +106 -0
- data/lib/raiha/tls/signature_scheme.rb +35 -0
- data/lib/raiha/tls/tcp/acceptor.rb +121 -0
- data/lib/raiha/tls/tcp/connection.rb +371 -0
- data/lib/raiha/tls/tcp/event.rb +15 -0
- data/lib/raiha/tls/tcp/socket.rb +161 -0
- data/lib/raiha/tls/tcp.rb +14 -0
- data/lib/raiha/tls/test/fixed_kem.rb +30 -0
- data/lib/raiha/tls/test/fixed_random.rb +18 -0
- data/lib/raiha/tls/test/rfc8448.rb +923 -0
- data/lib/raiha/tls/test/rfc8448_handshakes.rb +118 -0
- data/lib/raiha/tls/test.rb +13 -0
- data/lib/raiha/tls/ticket.rb +184 -0
- data/lib/raiha/tls/ticket_keys.rb +206 -0
- data/lib/raiha/tls/trace.rb +58 -0
- data/lib/raiha/tls/transcript.rb +94 -0
- data/lib/raiha/tls/verifier/default.rb +72 -0
- data/lib/raiha/tls/verifier/host_name.rb +75 -0
- data/lib/raiha/tls/verifier/none.rb +14 -0
- data/lib/raiha/tls/verifier.rb +24 -0
- data/lib/raiha/tls.rb +34 -0
- data/lib/raiha/version.rb +3 -1
- data/lib/raiha.rb +8 -5
- data/sig/patches/array.rbs +9 -0
- data/sig/patches/io_buffer.rbs +13 -0
- data/sig/patches/openssl.rbs +25 -0
- data/sig/patches/socket.rbs +29 -0
- data/sig/patches/string.rbs +26 -0
- data/sig/patches/strscan.rbs +12 -0
- data/sig/raiha/http3/capsule.rbs +32 -0
- data/sig/raiha/http3/connection.rbs +324 -0
- data/sig/raiha/http3/frame.rbs +138 -0
- data/sig/raiha/http3/frame_reader.rbs +39 -0
- data/sig/raiha/http3/message.rbs +23 -0
- data/sig/raiha/http3/priority.rbs +40 -0
- data/sig/raiha/http3/qlog.rbs +54 -0
- data/sig/raiha/http3/qpack.rbs +246 -0
- data/sig/raiha/http3/session.rbs +11 -0
- data/sig/raiha/http3/settings.rbs +26 -0
- data/sig/raiha/http3.rbs +2 -0
- data/sig/raiha/http3_binding.rbs +26 -0
- data/sig/raiha/namespace.rbs +2 -0
- data/sig/raiha/quic/config.rbs +89 -0
- data/sig/raiha/quic/congestion.rbs +213 -0
- data/sig/raiha/quic/connection.rbs +249 -0
- data/sig/raiha/quic/connection_ids.rbs +34 -0
- data/sig/raiha/quic/crypto.rbs +78 -0
- data/sig/raiha/quic/crypto_stream.rbs +34 -0
- data/sig/raiha/quic/datagrams.rbs +32 -0
- data/sig/raiha/quic/endpoint.rbs +179 -0
- data/sig/raiha/quic/frame.rbs +387 -0
- data/sig/raiha/quic/issued_connection_ids.rbs +47 -0
- data/sig/raiha/quic/kept_packets.rbs +25 -0
- data/sig/raiha/quic/mtu_search.rbs +21 -0
- data/sig/raiha/quic/negotiation.rbs +33 -0
- data/sig/raiha/quic/new_token.rbs +14 -0
- data/sig/raiha/quic/pacer.rbs +16 -0
- data/sig/raiha/quic/packet_protection.rbs +63 -0
- data/sig/raiha/quic/path.rbs +106 -0
- data/sig/raiha/quic/peer_connection_ids.rbs +42 -0
- data/sig/raiha/quic/qlog.rbs +74 -0
- data/sig/raiha/quic/ranges.rbs +7 -0
- data/sig/raiha/quic/recovery.rbs +376 -0
- data/sig/raiha/quic/retry_token.rbs +21 -0
- data/sig/raiha/quic/route.rbs +51 -0
- data/sig/raiha/quic/scheduler.rbs +36 -0
- data/sig/raiha/quic/session.rbs +17 -0
- data/sig/raiha/quic/stateless_reset.rbs +10 -0
- data/sig/raiha/quic/streams.rbs +244 -0
- data/sig/raiha/quic/test.rbs +354 -0
- data/sig/raiha/quic/tls_binding.rbs +58 -0
- data/sig/raiha/quic/token.rbs +11 -0
- data/sig/raiha/quic/tracer.rbs +71 -0
- data/sig/raiha/quic/transport_parameters.rbs +113 -0
- data/sig/raiha/quic/values.rbs +200 -0
- data/sig/raiha/quic/version.rbs +30 -0
- data/sig/raiha/quic/wire.rbs +199 -0
- data/sig/raiha/quic.rbs +2 -0
- data/sig/raiha/runtime/threaded.rbs +616 -0
- data/sig/raiha/runtime.rbs +982 -0
- data/sig/raiha/tls/anti_replay.rbs +41 -0
- data/sig/raiha/tls/cipher_suite.rbs +41 -0
- data/sig/raiha/tls/codec.rbs +66 -0
- data/sig/raiha/tls/config.rbs +122 -0
- data/sig/raiha/tls/crypto.rbs +86 -0
- data/sig/raiha/tls/error.rbs +21 -0
- data/sig/raiha/tls/event.rbs +61 -0
- data/sig/raiha/tls/extension.rbs +331 -0
- data/sig/raiha/tls/handshake.rbs +311 -0
- data/sig/raiha/tls/iana.rbs +13 -0
- data/sig/raiha/tls/key_exchange.rbs +33 -0
- data/sig/raiha/tls/key_schedule.rbs +58 -0
- data/sig/raiha/tls/keylog.rbs +20 -0
- data/sig/raiha/tls/keyring.rbs +64 -0
- data/sig/raiha/tls/machine.rbs +429 -0
- data/sig/raiha/tls/masked_inspect.rbs +12 -0
- data/sig/raiha/tls/output.rbs +37 -0
- data/sig/raiha/tls/profile.rbs +26 -0
- data/sig/raiha/tls/record.rbs +79 -0
- data/sig/raiha/tls/server_name.rbs +10 -0
- data/sig/raiha/tls/session.rbs +48 -0
- data/sig/raiha/tls/signature_scheme.rbs +20 -0
- data/sig/raiha/tls/tcp.rbs +134 -0
- data/sig/raiha/tls/test.rbs +143 -0
- data/sig/raiha/tls/ticket.rbs +68 -0
- data/sig/raiha/tls/ticket_keys.rbs +67 -0
- data/sig/raiha/tls/trace.rbs +99 -0
- data/sig/raiha/tls/transcript.rbs +22 -0
- data/sig/raiha/tls/verifier.rbs +54 -0
- data/sig/raiha/tls.rbs +5 -0
- data/sig/raiha.rbs +3 -0
- metadata +355 -57
- data/.gitignore +0 -10
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -22
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/raiha.gemspec +0 -40
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Raiha::Runtime
|
|
4
|
+
module Threaded
|
|
5
|
+
# Runs an Endpoint on a UDP socket, and on others besides, as the
|
|
6
|
+
# Driver of fibers does, with threads of its own: a reader for each
|
|
7
|
+
# socket ("raiha-reader") waits for datagrams and gives them to the
|
|
8
|
+
# Endpoint, and the runner ("raiha-runner") runs the timers, lets the
|
|
9
|
+
# owner take its turn and sends what there is to send, then waits until
|
|
10
|
+
# a timer is due or something has changed.
|
|
11
|
+
#
|
|
12
|
+
# The core lock, a Monitor, is held around each call into the core,
|
|
13
|
+
# the Endpoint's and those of the owner, which call into its
|
|
14
|
+
# connections; what other threads call into the core, a Session's
|
|
15
|
+
# methods, takes it too, with `synchronize`, and waits on a condition
|
|
16
|
+
# of it (`new_cond`). No I/O is done under it: a reader waits for and
|
|
17
|
+
# receives datagrams without it, and the Transmits taken under it go
|
|
18
|
+
# once it is let go, each socket sending one at a time. A `flush` under
|
|
19
|
+
# the lock, from the owner's turn, leaves what it took for the runner
|
|
20
|
+
# to send after the turn, before what the turn has to send; so does a
|
|
21
|
+
# `stop` under it the closing of the sockets.
|
|
22
|
+
#
|
|
23
|
+
# The owner is told of each Route but a response to send, takes its
|
|
24
|
+
# turn each time round with a timer of its own, and is told when the
|
|
25
|
+
# driver stops, with what failed when something did, all under the
|
|
26
|
+
# lock; it writes its traces with `flush_traces`, called without the
|
|
27
|
+
# lock after each turn and once the driver has stopped.
|
|
28
|
+
class Driver
|
|
29
|
+
attr_reader :endpoint
|
|
30
|
+
|
|
31
|
+
def self.clock = Raiha::Runtime::Driver.clock
|
|
32
|
+
|
|
33
|
+
def initialize(endpoint, udp, owner, others: [])
|
|
34
|
+
@endpoint = endpoint
|
|
35
|
+
@udp = udp
|
|
36
|
+
@udps = [udp, *others]
|
|
37
|
+
@owner = owner
|
|
38
|
+
@core = Monitor.new
|
|
39
|
+
# Only for the runner to wait on.
|
|
40
|
+
@changed = @core.new_cond
|
|
41
|
+
@dirty = false
|
|
42
|
+
@stopped = false
|
|
43
|
+
@failure = nil #: StandardError?
|
|
44
|
+
# What a flush under the lock took, for the runner to send.
|
|
45
|
+
@queued = [] #: Array[Raiha::QUIC::Transmit]
|
|
46
|
+
@sending = @udps.to_h { |socket| [socket, Thread::Mutex.new] } #: Hash[UDP, Thread::Mutex]
|
|
47
|
+
@readers = [] #: Array[Thread]
|
|
48
|
+
@runner = nil #: Thread?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Starts the reader of each socket and the runner, each a thread.
|
|
52
|
+
def start
|
|
53
|
+
@readers = @udps.map do |udp|
|
|
54
|
+
Thread.new { read(udp) }.tap { |thread| thread.name = "raiha-reader" }
|
|
55
|
+
end
|
|
56
|
+
@runner = Thread.new { run }.tap { |thread| thread.name = "raiha-runner" }
|
|
57
|
+
self
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Holds the core lock around the block, as whatever calls into the
|
|
61
|
+
# core does; the block's value.
|
|
62
|
+
def synchronize(&) = @core.synchronize(&)
|
|
63
|
+
|
|
64
|
+
# A condition of the core lock, to wait on while holding it.
|
|
65
|
+
def new_cond = @core.new_cond
|
|
66
|
+
|
|
67
|
+
# Whether this thread holds the core lock.
|
|
68
|
+
def mon_owned? = @core.mon_owned?
|
|
69
|
+
|
|
70
|
+
# What failed in the driver, if anything did.
|
|
71
|
+
def failure = @core.synchronize { @failure }
|
|
72
|
+
|
|
73
|
+
# Has the runner go round again, as after a call into the core.
|
|
74
|
+
def changed
|
|
75
|
+
@core.synchronize do
|
|
76
|
+
@dirty = true
|
|
77
|
+
@changed.signal
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def stopped? = @core.synchronize { @stopped }
|
|
82
|
+
|
|
83
|
+
# Sends what there is to send now, as the last datagrams of a
|
|
84
|
+
# connection closed before the driver stops: from this thread once
|
|
85
|
+
# the lock is let go, or, when this thread holds the lock, from the
|
|
86
|
+
# runner after its turn.
|
|
87
|
+
def flush
|
|
88
|
+
if @core.mon_owned?
|
|
89
|
+
@endpoint.each_transmit(now: Driver.clock) { |transmit| @queued << transmit }
|
|
90
|
+
changed
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
transmits = [] #: Array[Raiha::QUIC::Transmit]
|
|
94
|
+
@core.synchronize { @endpoint.each_transmit(now: Driver.clock) { |transmit| transmits << transmit } }
|
|
95
|
+
transmits.each { |transmit| emit(transmit) }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Stops the readers and the runner and closes the sockets; the owner
|
|
99
|
+
# is told once, under the lock. The sockets close even when telling
|
|
100
|
+
# the owner fails: while the runner runs, it closes them once it has
|
|
101
|
+
# sent what is left, a flush's from the turn that stopped it say;
|
|
102
|
+
# otherwise they close at once, and the owner writes its traces.
|
|
103
|
+
def stop
|
|
104
|
+
@core.synchronize do
|
|
105
|
+
next if @stopped
|
|
106
|
+
@stopped = true
|
|
107
|
+
@changed.signal
|
|
108
|
+
@owner.stopped(@failure)
|
|
109
|
+
end
|
|
110
|
+
ensure
|
|
111
|
+
unless @runner&.alive?
|
|
112
|
+
close
|
|
113
|
+
@owner.flush_traces unless @core.mon_owned?
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Waits for the readers and the runner to end, once stopped.
|
|
118
|
+
def join
|
|
119
|
+
[*@readers, @runner].each { |thread| thread&.join }
|
|
120
|
+
nil
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
private def read(udp)
|
|
124
|
+
until @stopped
|
|
125
|
+
udp.wait_readable
|
|
126
|
+
datagrams = udp.receive
|
|
127
|
+
now = Driver.clock
|
|
128
|
+
responses = @core.synchronize do
|
|
129
|
+
next [] if @stopped
|
|
130
|
+
taken = take(datagrams, now)
|
|
131
|
+
@dirty = true
|
|
132
|
+
@changed.signal
|
|
133
|
+
taken
|
|
134
|
+
end
|
|
135
|
+
responses.each { |transmit| emit(transmit) }
|
|
136
|
+
end
|
|
137
|
+
rescue IOError, Errno::EBADF
|
|
138
|
+
raise unless @stopped
|
|
139
|
+
rescue StandardError => error
|
|
140
|
+
fail(error)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Gives each datagram to the Endpoint, and each Route to the owner; the
|
|
144
|
+
# responses the Endpoint sends itself.
|
|
145
|
+
private def take(datagrams, now)
|
|
146
|
+
responses = [] #: Array[Raiha::QUIC::Transmit]
|
|
147
|
+
datagrams.each do |data, from, to, ecn|
|
|
148
|
+
case (route = @endpoint.receive(data, from:, to:, ecn:, now:))
|
|
149
|
+
when Raiha::QUIC::Route::Respond then responses << route.transmit
|
|
150
|
+
when nil then nil
|
|
151
|
+
else @owner.route(route, now)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
responses
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
private def run
|
|
158
|
+
until @stopped
|
|
159
|
+
transmits = @core.synchronize { turn(Driver.clock) }
|
|
160
|
+
transmits.each { |transmit| emit(transmit) }
|
|
161
|
+
@owner.flush_traces
|
|
162
|
+
@core.synchronize do
|
|
163
|
+
@changed.wait(timeout) unless @dirty || @stopped
|
|
164
|
+
@dirty = false
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
rescue IOError, Errno::EBADF
|
|
168
|
+
raise unless @stopped
|
|
169
|
+
rescue StandardError => error
|
|
170
|
+
fail(error)
|
|
171
|
+
ensure
|
|
172
|
+
last
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# The timers of the Endpoint, the owner's turn, and what there is to
|
|
176
|
+
# send after, what a flush in the turn took first.
|
|
177
|
+
private def turn(now)
|
|
178
|
+
deadline = @endpoint.next_timeout
|
|
179
|
+
@endpoint.handle_timeout(now:) if deadline && deadline <= now
|
|
180
|
+
@owner.turn(now)
|
|
181
|
+
@endpoint.each_transmit(now:) { |transmit| @queued << transmit }
|
|
182
|
+
transmits = @queued
|
|
183
|
+
@queued = []
|
|
184
|
+
transmits
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# What a flush or a stop under the lock left for the runner, once it
|
|
188
|
+
# has stopped: what was taken goes, the sockets close, and the owner
|
|
189
|
+
# writes its traces.
|
|
190
|
+
private def last
|
|
191
|
+
return unless @stopped
|
|
192
|
+
transmits = @core.synchronize do
|
|
193
|
+
taken = @queued
|
|
194
|
+
@queued = []
|
|
195
|
+
taken
|
|
196
|
+
end
|
|
197
|
+
begin
|
|
198
|
+
transmits.each { |transmit| emit(transmit) }
|
|
199
|
+
rescue IOError, Errno::EBADF
|
|
200
|
+
nil
|
|
201
|
+
end
|
|
202
|
+
close
|
|
203
|
+
@owner.flush_traces
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Seconds until the next timer, nil for none.
|
|
207
|
+
private def timeout
|
|
208
|
+
deadline = [@endpoint.next_timeout, @owner.next_timeout].compact.min or return nil
|
|
209
|
+
[deadline - Driver.clock, 0.0].max
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Sends `transmit` from the socket its source is on, one Transmit at a
|
|
213
|
+
# time on each socket, as UDP#send keeps what it learns of the OS.
|
|
214
|
+
private def emit(transmit)
|
|
215
|
+
source = transmit.source
|
|
216
|
+
udp = source && @udps.find { |socket| socket.sends_from?(source) } || @udp
|
|
217
|
+
@sending.fetch(udp).synchronize { udp.send(transmit) }
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
private def close
|
|
221
|
+
@udps.each { |udp| udp.close unless udp.closed? }
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
private def fail(error)
|
|
225
|
+
@core.synchronize { @failure ||= error }
|
|
226
|
+
stop
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "stringio"
|
|
4
|
+
require_relative "../../http3_binding"
|
|
5
|
+
require_relative "../../http3/session"
|
|
6
|
+
|
|
7
|
+
module Raiha::Runtime
|
|
8
|
+
module Threaded
|
|
9
|
+
# The HTTP/3 of the runtime on threads, as Runtime::HTTP3 is of the
|
|
10
|
+
# runtime of fibers: a client over a Threaded::Session, and a server.
|
|
11
|
+
# What waits for nothing it shares with the runtime of fibers: Exchange,
|
|
12
|
+
# Response, StreamReset and Fields.
|
|
13
|
+
module HTTP3
|
|
14
|
+
StreamReset = Raiha::Runtime::HTTP3::StreamReset
|
|
15
|
+
Response = Raiha::Runtime::HTTP3::Response
|
|
16
|
+
Exchange = Raiha::Runtime::HTTP3::Exchange
|
|
17
|
+
Fields = Raiha::Runtime::HTTP3::Fields
|
|
18
|
+
|
|
19
|
+
# The body of a request at a server, or of a response at a client,
|
|
20
|
+
# read as it comes.
|
|
21
|
+
class Body
|
|
22
|
+
def initialize(reader, stream_id)
|
|
23
|
+
@reader = reader
|
|
24
|
+
@stream_id = stream_id
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The next chunk once there is one, nil at the end.
|
|
28
|
+
def read_chunk = @reader.read_chunk(@stream_id)
|
|
29
|
+
|
|
30
|
+
# Each chunk until the end, waiting for each.
|
|
31
|
+
def each
|
|
32
|
+
while (chunk = read_chunk)
|
|
33
|
+
yield chunk
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# All of what is left.
|
|
38
|
+
def read
|
|
39
|
+
data = "".b
|
|
40
|
+
each { |chunk| data << chunk }
|
|
41
|
+
data
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# A response as it comes, given to the block of Client#request once
|
|
46
|
+
# its header section has.
|
|
47
|
+
class ResponseStream
|
|
48
|
+
attr_reader :status, :headers, :body
|
|
49
|
+
|
|
50
|
+
def initialize(client, stream_id, exchange, status)
|
|
51
|
+
@client = client
|
|
52
|
+
@stream_id = stream_id
|
|
53
|
+
@exchange = exchange
|
|
54
|
+
@status = status
|
|
55
|
+
@headers = exchange.headers
|
|
56
|
+
@body = Body.new(client, stream_id)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The trailer fields, once the body has been read to its end.
|
|
60
|
+
def trailers = @exchange.trailers
|
|
61
|
+
|
|
62
|
+
# Stops the request and its response with H3_REQUEST_CANCELLED.
|
|
63
|
+
def cancel
|
|
64
|
+
@client.cancel(@stream_id)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# The client of HTTP/3 over a Threaded::Session, as the HTTP3::Client
|
|
69
|
+
# of fibers is, to be used from several threads at once: each request
|
|
70
|
+
# goes on a stream of its own, and the thread that made it writes its
|
|
71
|
+
# body, reading it without the core lock, and waits for its response.
|
|
72
|
+
# A Session of fibers is Error::Usage.
|
|
73
|
+
class Client
|
|
74
|
+
PIECE = Raiha::Runtime::HTTP3::Client::PIECE
|
|
75
|
+
ALPN = Raiha::Runtime::HTTP3::Client::ALPN
|
|
76
|
+
|
|
77
|
+
def initialize(session, authority: nil, settings: Raiha::HTTP3::Settings.new)
|
|
78
|
+
raise Error::Usage, "a Session of the runtime on threads, not #{session.class}" unless session.is_a?(Threaded::Session)
|
|
79
|
+
@session = session
|
|
80
|
+
@settings = settings
|
|
81
|
+
@tracer = (quic = session.tracer) && Raiha::HTTP3::Qlog::Tracer.new(quic)
|
|
82
|
+
@http3 = Raiha::HTTP3::Connection.client(settings:, tracer: @tracer, remembered:)
|
|
83
|
+
@binding = Raiha::HTTP3Binding.new(session.core, @http3)
|
|
84
|
+
@exchanges = {} #: Hash[Integer, Exchange]
|
|
85
|
+
session.attach(self, close_code: Raiha::HTTP3::ErrorCode::NO_ERROR)
|
|
86
|
+
@authority = authority || session.server_name || raise(Error::Usage, "no authority to request from")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# The tickets the server gave, each an HTTP3::Session with the
|
|
90
|
+
# server's SETTINGS; none until the SETTINGS have come.
|
|
91
|
+
def tickets
|
|
92
|
+
@session.synchronize do
|
|
93
|
+
settings = @http3.peer_settings or next []
|
|
94
|
+
@session.tickets.map { |quic| Raiha::HTTP3::Session.new(quic:, settings:) }
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# The response to a GET of `path`, its body read whole.
|
|
99
|
+
def get(path, headers: [])
|
|
100
|
+
request("GET", path, headers:)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Sends a request, as HTTP3::Client#request of fibers does: the
|
|
104
|
+
# response comes to the block, which runs without the core lock, as
|
|
105
|
+
# a ResponseStream; with no block, it is read whole into a Response.
|
|
106
|
+
def request(method, path, headers: [], body: nil, urgency: nil, incremental: nil)
|
|
107
|
+
stream_id, exchange = start(method, path, headers + Fields.priority(urgency, incremental), fin: body.nil?)
|
|
108
|
+
upload(stream_id, exchange, body) if body
|
|
109
|
+
status = @session.wait_for(drain: true) do
|
|
110
|
+
check(stream_id, exchange)
|
|
111
|
+
exchange.status
|
|
112
|
+
end
|
|
113
|
+
return yield ResponseStream.new(self, stream_id, exchange, status) if block_given?
|
|
114
|
+
Response.new(status:, headers: exchange.headers, body: Body.new(self, stream_id).read, trailers: exchange.trailers)
|
|
115
|
+
ensure
|
|
116
|
+
finish(stream_id, exchange) if stream_id && exchange
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# The next chunk of the response on `stream_id` once there is one,
|
|
120
|
+
# nil at its end; for Body.
|
|
121
|
+
def read_chunk(stream_id)
|
|
122
|
+
@session.synchronize do
|
|
123
|
+
exchange = @exchanges[stream_id] or next nil
|
|
124
|
+
chunk = @session.wait_for(drain: true) do
|
|
125
|
+
check(stream_id, exchange)
|
|
126
|
+
exchange.shift || (:end if exchange.ended?)
|
|
127
|
+
end
|
|
128
|
+
resume(stream_id, exchange) if exchange.paused && !exchange.full?
|
|
129
|
+
chunk if chunk.is_a?(String)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Stops the request on `stream_id` and its response; for
|
|
134
|
+
# ResponseStream.
|
|
135
|
+
def cancel(stream_id)
|
|
136
|
+
@session.synchronize do
|
|
137
|
+
exchange = @exchanges[stream_id] or next
|
|
138
|
+
next if exchange.ended? || exchange.reset
|
|
139
|
+
@http3.cancel(stream_id)
|
|
140
|
+
exchange.end!(dropped: true)
|
|
141
|
+
@binding.resume(stream_id)
|
|
142
|
+
flush
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# The Session's protocol, under the core lock: the events of QUIC
|
|
147
|
+
# that are HTTP/3's.
|
|
148
|
+
def take(event, now)
|
|
149
|
+
case event
|
|
150
|
+
when Raiha::QUIC::Event::ZeroRttRejected then zero_rtt_rejected
|
|
151
|
+
when Raiha::QUIC::Event::Connected
|
|
152
|
+
alpn = event.handshake.alpn
|
|
153
|
+
unless alpn == ALPN
|
|
154
|
+
@session.core.close(error_code: Raiha::HTTP3::ErrorCode::GENERAL_PROTOCOL_ERROR, reason: "ALPN #{alpn.inspect}, not h3", now:)
|
|
155
|
+
return false
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
@binding.receive(event, now:)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# The Session's protocol: a client's session runs out of no server's
|
|
162
|
+
# time.
|
|
163
|
+
def expire = nil
|
|
164
|
+
|
|
165
|
+
# The Session's protocol, under the core lock.
|
|
166
|
+
def turn(now)
|
|
167
|
+
@binding.flush(now:)
|
|
168
|
+
@http3.each_event { |event| take_http3(event) }
|
|
169
|
+
@binding.flush(now:)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Sends the request on a new stream, holding the core lock from when
|
|
173
|
+
# the stream is open until its Exchange is kept, so that no event of
|
|
174
|
+
# it is taken in between: its ID and the Exchange.
|
|
175
|
+
private def start(method, path, headers, fin:)
|
|
176
|
+
@session.synchronize do
|
|
177
|
+
stream_id = @session.open_stream_id
|
|
178
|
+
exchange = @exchanges[stream_id] = Exchange.new
|
|
179
|
+
begin
|
|
180
|
+
@http3.send_request(stream_id, Fields.request(method, @authority, path) + headers, fin:)
|
|
181
|
+
rescue StandardError
|
|
182
|
+
@exchanges.delete(stream_id)
|
|
183
|
+
@session.core.stream_reset(stream_id, error_code: Raiha::HTTP3::ErrorCode::REQUEST_CANCELLED)
|
|
184
|
+
@session.core.stream_stop_sending(stream_id, error_code: Raiha::HTTP3::ErrorCode::REQUEST_CANCELLED)
|
|
185
|
+
@session.changed
|
|
186
|
+
raise
|
|
187
|
+
end
|
|
188
|
+
flush
|
|
189
|
+
[stream_id, exchange] #: [Integer, Exchange]
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
private def remembered
|
|
194
|
+
resumed = @session.resumed
|
|
195
|
+
resumed.settings if resumed.is_a?(Raiha::HTTP3::Session) && @session.connection.zero_rtt_state == :pending
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Writes `body` as the request's content, read a piece at a time
|
|
199
|
+
# without the core lock, and ends it.
|
|
200
|
+
private def upload(stream_id, exchange, body)
|
|
201
|
+
source = body.is_a?(String) ? StringIO.new(body) : body
|
|
202
|
+
while (piece = source.read(PIECE))
|
|
203
|
+
written = 0
|
|
204
|
+
until written == piece.bytesize
|
|
205
|
+
written += @session.wait_for do
|
|
206
|
+
check(stream_id, exchange)
|
|
207
|
+
stopped = exchange.stopped and return check_stopped(stream_id, stopped)
|
|
208
|
+
taken = @http3.send_data(stream_id, piece.byteslice(written..) || "".b)
|
|
209
|
+
next nil unless taken.positive?
|
|
210
|
+
flush
|
|
211
|
+
taken
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
@session.synchronize do
|
|
216
|
+
@http3.send_data(stream_id, "".b, fin: true)
|
|
217
|
+
flush
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
private def check_stopped(stream_id, error_code)
|
|
222
|
+
raise StreamReset.new(stream_id, error_code) unless error_code == Raiha::HTTP3::ErrorCode::NO_ERROR
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
private def check(stream_id, exchange)
|
|
226
|
+
raise Raiha::QUIC::Error::ZeroRttRejected, "the request on stream #{stream_id} went in rejected 0-RTT" if exchange.rejected
|
|
227
|
+
reset = exchange.reset and raise StreamReset.new(stream_id, reset)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Lets go of what was kept of the request; a response not read to
|
|
231
|
+
# its end is cancelled.
|
|
232
|
+
private def finish(stream_id, exchange)
|
|
233
|
+
@session.synchronize do
|
|
234
|
+
next unless @exchanges[stream_id].equal?(exchange)
|
|
235
|
+
cancel(stream_id)
|
|
236
|
+
@exchanges.delete(stream_id)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
private def zero_rtt_rejected
|
|
241
|
+
@exchanges.each_value { |exchange| exchange.rejected = true }
|
|
242
|
+
@exchanges.clear
|
|
243
|
+
@http3 = Raiha::HTTP3::Connection.client(settings: @settings, tracer: @tracer)
|
|
244
|
+
@binding.restart(@http3)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
private def resume(stream_id, exchange)
|
|
248
|
+
exchange.paused = false
|
|
249
|
+
@binding.resume(stream_id)
|
|
250
|
+
flush
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
private def flush
|
|
254
|
+
@binding.flush(now: Driver.clock)
|
|
255
|
+
@session.changed
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
private def take_http3(event)
|
|
259
|
+
case event
|
|
260
|
+
when Raiha::HTTP3::Event::Headers
|
|
261
|
+
exchange = @exchanges[event.stream_id] or return
|
|
262
|
+
status = Fields.status(event.headers) or return
|
|
263
|
+
exchange.status = status
|
|
264
|
+
exchange.headers = Fields.split(event.headers).last
|
|
265
|
+
exchange.end! if event.fin
|
|
266
|
+
when Raiha::HTTP3::Event::Data
|
|
267
|
+
exchange = @exchanges[event.stream_id] or return
|
|
268
|
+
exchange << event.data unless event.data.empty?
|
|
269
|
+
exchange.end! if event.fin
|
|
270
|
+
pause(event.stream_id, exchange) if exchange.full? && !exchange.paused
|
|
271
|
+
when Raiha::HTTP3::Event::Trailers
|
|
272
|
+
exchange = @exchanges[event.stream_id] or return
|
|
273
|
+
exchange.trailers = event.headers
|
|
274
|
+
exchange.end!
|
|
275
|
+
when Raiha::HTTP3::Event::Reset then @exchanges[event.stream_id]&.reset = event.error_code
|
|
276
|
+
when Raiha::HTTP3::Event::Stopped then @exchanges[event.stream_id]&.stopped = event.error_code
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
private def pause(stream_id, exchange)
|
|
281
|
+
exchange.paused = true
|
|
282
|
+
@binding.pause(stream_id)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|