diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2025-05-20 16:37:51 -0700 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2025-05-20 18:04:37 -0700 |
| commit | 1c66124273ec37e1c359fc327ab25be99a6f7fa9 (patch) | |
| tree | 32ef3bbbd88a98e3d9623334958e24b0275d0c8d /test/socket | |
| parent | b08e20d34afb1cb99eeb97b4b7330290556511d3 (diff) | |
Make Addrinfo objects Ractor shareable
Allow Addrinfo objects to be shared among Ractors. Addrinfo objects are
already immutable, so I think it's safe for us to tag them as
RUBY_TYPED_FROZEN_SHAREABLE shareable too.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13388
Diffstat (limited to 'test/socket')
| -rw-r--r-- | test/socket/test_addrinfo.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index c61764d76d..0c9529090e 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -360,6 +360,12 @@ class TestSocketAddrinfo < Test::Unit::TestCase assert_raise(Socket::ResolutionError) { Addrinfo.tcp("0.0.0.0", 4649).family_addrinfo("::1", 80) } end + def test_ractor_shareable + assert_ractor(<<~'RUBY', require: 'socket', timeout: 60) + Ractor.make_shareable Addrinfo.new "\x10\x02\x14\xE9\xE0\x00\x00\xFB\x00\x00\x00\x00\x00\x00\x00\x00".b + RUBY + end + def random_port # IANA suggests dynamic port for 49152 to 65535 # http://www.iana.org/assignments/port-numbers |
