Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket helper: Support connect_timeout for TCP/TLS #2467

Merged
merged 1 commit into from
Jun 20, 2019

Conversation

repeatedly
Copy link
Member

out_forward also supports connect_timeout parameter

Signed-off-by: Masahiro Nakagawa [email protected]

Which issue(s) this PR fixes:
None

What this PR does / why we need it:

Docs Changes:
After release v1.6.0, need to add connect_timeout parameter to socket helper/out_forward article.

Release Note:
socket helper/out_forward: Support connect_timeout parameter

@repeatedly repeatedly added the enhancement Feature request or improve operations label Jun 19, 2019
@repeatedly repeatedly requested a review from ganmacs June 19, 2019 14:39
@repeatedly repeatedly self-assigned this Jun 19, 2019
out_forward also supports connect_timeout parameter

Signed-off-by: Masahiro Nakagawa <[email protected]>
@repeatedly repeatedly force-pushed the socket-connect-timeout branch from 24cefc3 to e6b3006 Compare June 19, 2019 15:27
Copy link
Member

@ganmacs ganmacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't tls and udp need to support connect_timeout?

sock = WrappedSocket::TCP.new(host, port)
def socket_create_tcp(host, port, resolve_name: false, connect_timeout: nil, **kwargs, &block)
sock = if connect_timeout
s = ::Socket.tcp(host, port, connect_timeout: connect_timeout)
Copy link
Member

@ganmacs ganmacs Jun 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when and who will close this socket if it is set false to autoclose?

Ah, WrappedSocket::TCP will close this socket.

https://github.com/ruby/ruby/blob/e4cafa393f8fd4aa207f20b1d122884b4de99cf1/io.c#L8436-L8451

@repeatedly
Copy link
Member Author

TLS supports connect_timeout via TCP socket creation.
udp is connectionless. what is the timeout for udp?

Copy link
Member

@ganmacs ganmacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@repeatedly repeatedly merged commit 910ec4c into master Jun 20, 2019
@repeatedly repeatedly deleted the socket-connect-timeout branch June 20, 2019 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or improve operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants