Project

General

Profile

« Previous | Next » 

Revision 2f5d31d3

Added by byroot (Jean Boussier) 6 months ago

[ruby/openssl] Reduce OpenSSL::Buffering#do_write overhead

[Bug #20972]

The rb_str_new_freeze was added in https://github.com/ruby/openssl/issues/452
to better handle concurrent use of a Socket, but SSL sockets can't be used
concurrently AFAIK, so we might as well just error cleanly.

By using rb_str_locktmp we can ensure attempts at concurrent write
will raise an error, be we avoid causing a copy of the bytes.

We also use the newer String#append_as_bytes method when available
to save on some more copies.

https://github.com/ruby/openssl/commit/0d8c17aa85

Co-Authored-By: