Skip to content

Commit

Permalink
make configs shareable when frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
HoneyryderChuck authored and rhenium committed Dec 7, 2024
1 parent 3cc1825 commit 654cb22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/openssl/ossl_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
9 changes: 9 additions & 0 deletions test/openssl/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 654cb22

Please sign in to comment.