Module: QuietQUIC

Defined in:
lib/quietquic/await.rb,
lib/quietquic/client.rb,
lib/quietquic/server.rb,
lib/quietquic/stream.rb,
lib/quietquic/version.rb,
lib/quietquic/connection.rb

Overview

SPDX-License-Identifier: 0BSD

Defined Under Namespace

Classes: Client, Connection, Server, Stream

Constant Summary collapse

VERSION =
"0.1.0.alpha.3"

Class Method Summary collapse

Class Method Details

.await(op) ⇒ Object

Wait for an in-flight native operation (a PendingOp) to complete and return its result, raising the mapped QuietQUIC::* exception on failure.

Waiting goes through IO#wait_readable on the op's self-pipe fd, which is fiber-scheduler aware (Ruby >= 3.0): under Async it parks the fiber and lets the reactor run other tasks; with no scheduler it blocks while releasing the GVL.

autoclose: false is a hard invariant: Rust owns the fd and closes it on disposal, so the Ruby IO must never autoclose it (that would double-close).

The op is explicitly disposed in an ensure so its pipe fds are freed at await-completion rather than whenever the GC eventually runs the finalizer.



16
17
18
19
20
21
# File 'lib/quietquic/await.rb', line 16

def self.await(op)
  IO.for_fd(op.fd, autoclose: false).wait_readable
  op.take_result
ensure
  op.close
end