Actions
Feature #12928
openUse socket conect_timeout in net stdlib for open_timeout
Feature #12928:
Use socket conect_timeout in net stdlib for open_timeout
Status:
Open
Assignee:
-
Target version:
-
Description
Current net/http and net/pop use Timeout.timeout to tigger open_timeout event.
Timeout.timeout is slow. It will create and destroy a thread every time.
Timeout.timeout is also dangerous. see [[http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/]]
It is more effective and safe to use socket timeout to accomplish this.
Follow is the changes need to do.
- Replace TCPSocket.open with Socket.new
- Use socket.connect_nonblock and IO.select to connect and trigger timeout event.
The pull request is here:
[[https://github.com/ruby/ruby/pull/1480]]
Actions