[前][次][番号順一覧][スレッド一覧]

ruby-changes:74206

From: nagachika <ko1@a...>
Date: Sat, 22 Oct 2022 17:09:36 +0900 (JST)
Subject: [ruby-changes:74206] 2c1b1eae7c (ruby_3_1): merge revision(s) f88bff770578583a708093f4a0d8b1483a1d2039:

https://git.ruby-lang.org/ruby.git/commit/?id=2c1b1eae7c

From 2c1b1eae7c984c9ff4788d382bc2edcd4ed91ef5 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Sat, 22 Oct 2022 17:08:57 +0900
Subject: merge revision(s) f88bff770578583a708093f4a0d8b1483a1d2039:

	[ruby/net-http] Revert "Replace Timeout.timeout in Net:HTTP#connect"

	This reverts commit https://github.com/ruby/net-http/commit/753cae3bbccc.

	https://github.com/ruby/net-http/commit/98caa38204
	---
	 lib/net/http.rb | 15 ++++++++-------
	 1 file changed, 8 insertions(+), 7 deletions(-)
---
 lib/net/http.rb | 15 ++++++++-------
 version.h       |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/net/http.rb b/lib/net/http.rb
index f004bce836..002e3cf10e 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -994,13 +994,14 @@ module Net   #:nodoc: https://github.com/ruby/ruby/blob/trunk/lib/net/http.rb#L994
       end
 
       debug "opening connection to #{conn_addr}:#{conn_port}..."
-      begin
-        s = Socket.tcp conn_addr, conn_port, @local_host, @local_port, connect_timeout: @open_timeout
-      rescue => e
-        e = Net::OpenTimeout.new(e) if e.is_a?(Errno::ETIMEDOUT) #for compatibility with previous versions
-        raise e, "Failed to open TCP connection to " +
-          "#{conn_addr}:#{conn_port} (#{e.message})"
-      end
+      s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
+        begin
+          TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
+        rescue => e
+          raise e, "Failed to open TCP connection to " +
+            "#{conn_addr}:#{conn_port} (#{e.message})"
+        end
+      }
       s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
       debug "opened"
       if use_ssl?
diff --git a/version.h b/version.h
index 4c2ba43f94..2bfa800209 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L11
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 3
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 166
+#define RUBY_PATCHLEVEL 167
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 10
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]