Skip to content

Conversation

@noteflakes
Copy link
Contributor

@noteflakes noteflakes commented Feb 4, 2026

This PR adds SSL functionality, allowing using UringMachine's I/O API as the OpenSSL BIO method:

  • Add an API for setting the custom BIO for an SSLSocket.
  • Add APIs for reading and writing to an SSLSocket.

This is an alternative solution for integrating UringMachine with OpenSSL to the PR I submitted for adding support for custom BIOs: ruby/openssl#1000

Example usage:

# starting from a raw fd
sock = IO.for_fd(fd)
ctx = some_ssl_ctx
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
# set custom BIO:
machine.ssl_set_bio(ssl)
ssl.accept # or connect

# from this point on you can either use the normal IO methods:
ssl.read(...)
ssl.write(...)

# or, alternatively:
machine.ssl_read(ssl, ...)
machine.ssl_write(ssl, ...)

Performance

Using the custom BIO provides a small performance advantage, but not something that's earth shattering:

            user     system      total        real
stock   4.666976   3.690069   8.357045 (  8.363628)
UM BIO  4.562475   3.594215   8.156690 (  8.163844)
UM I/O  3.768159   3.611543   7.379702 (  7.384713)

@noteflakes noteflakes merged commit 61e33c2 into main Feb 4, 2026
3 checks passed
@noteflakes noteflakes deleted the openssl branch February 4, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant