Skip to content

Commit 736f04c

Browse files
Fix regression on Socket#connect timeout type restriction (#14755)
The `timeout` parameter of `system_connect` has an implict type restriction of `Time::Span?` and we need to convert numeric arguments. This fixes a regression introduced in #14643.
1 parent b0fff7e commit 736f04c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/socket.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class Socket < IO
110110
# Tries to connect to a remote address. Yields an `IO::TimeoutError` or an
111111
# `Socket::ConnectError` error if the connection failed.
112112
def connect(addr, timeout = nil, &)
113+
timeout = timeout.seconds unless timeout.is_a?(::Time::Span?)
113114
result = system_connect(addr, timeout)
114115
yield result if result.is_a?(Exception)
115116
end

0 commit comments

Comments
 (0)