From 654cb22e21fbd3f8e125e3fa6047b89659f82008 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Mon, 25 Nov 2024 08:53:16 +0000 Subject: [PATCH] make configs shareable when frozen --- ext/openssl/ossl_config.c | 2 +- test/openssl/test_config.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index 3b387239..ee2ff678 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -22,7 +22,7 @@ static const rb_data_type_t ossl_config_type = { { 0, nconf_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE, }; CONF * diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb index f165ca49..759a5bbd 100644 --- a/test/openssl/test_config.rb +++ b/test/openssl/test_config.rb @@ -277,6 +277,15 @@ def test_dup assert_equal(@it.sections.sort, c2.sections.sort) end + if respond_to?(:ractor) + ractor + def test_ractor + assert(Ractor.shareable?(@it)) + assert(Ractor.shareable?(OpenSSL::Config.parse("[empty]\n"))) + assert(Ractor.shareable?(OpenSSL::Config::DEFAULT_CONFIG_FILE)) + end + end + private def in_tmpdir(*args)