Allow disable to fast_fallback
of TCPSocket.new
(#12210)
with `Socket.tcp_fast_fallback=` The functions that `Socket.tcp` had are now also available in `TCPSocket.new`.
This commit is contained in:
parent
f9d0bc22f5
commit
22e1a8c478
Notes:
git
2024-11-29 05:18:31 +00:00
Merged-By: shioimm <shioi.mm@gmail.com>
@ -60,7 +60,7 @@ tcp_init(int argc, VALUE *argv, VALUE sock)
|
||||
VALUE kwargs[4];
|
||||
VALUE resolv_timeout = Qnil;
|
||||
VALUE connect_timeout = Qnil;
|
||||
VALUE fast_fallback = Qtrue;
|
||||
VALUE fast_fallback = Qnil;
|
||||
VALUE test_mode_settings = Qnil;
|
||||
|
||||
if (!keyword_ids[0]) {
|
||||
@ -81,6 +81,13 @@ tcp_init(int argc, VALUE *argv, VALUE sock)
|
||||
if (kwargs[3] != Qundef) { test_mode_settings = kwargs[3]; }
|
||||
}
|
||||
|
||||
if (fast_fallback == Qnil) {
|
||||
VALUE socket_class = rb_const_get(rb_cObject, rb_intern("Socket"));
|
||||
ID var_id = rb_intern("@tcp_fast_fallback");
|
||||
fast_fallback = rb_ivar_get(socket_class, var_id);
|
||||
if (fast_fallback == Qnil) fast_fallback = Qtrue;
|
||||
}
|
||||
|
||||
return rsock_init_inetsock(sock, remote_host, remote_serv,
|
||||
local_host, local_serv, INET_CLIENT,
|
||||
resolv_timeout, connect_timeout, fast_fallback,
|
||||
|
Loading…
x
Reference in New Issue
Block a user