Project

General

Profile

Actions

Feature #12928

open

Use socket conect_timeout in net stdlib for open_timeout

Added by xiewenwei (xie wenwei) about 8 years ago. Updated almost 5 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:78106]

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.

  1. Replace TCPSocket.open with Socket.new
  2. 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]]


Related issues 1 (1 open0 closed)

Related to Ruby master - Feature #12435: Using connect_nonblock to open TCP connections in Net::HTTP#connectOpenActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0