-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Breaking change to Crystal::System::Socket#system_connect
timeout type
#14752
Comments
|
|
We won't fix |
Thanks for reporting and fixing. Apparently this got lost in the heat of the moment. |
Actually, I believe the correct and direct fix would be to move the original conversion from --- i/src/socket.cr
+++ w/src/socket.cr
@@ -110,6 +110,7 @@ class Socket < IO
# Tries to connect to a remote address. Yields an `IO::TimeoutError` or an
# `Socket::ConnectError` error if the connection failed.
def connect(addr, timeout = nil, &)
+ timeout = timeout.seconds unless timeout.is_a? ::Time::Span | Nil
result = system_connect(addr, timeout)
yield result if result.is_a?(Exception)
end I've had this in my development branch, but it must've gotten lost somewhere during refactoring and rebasing. After this we can move forward with adding type restricitons to |
Bug Report
Related to #14368.
In #14643,
Crystal::System::Socket#system_connect
was changed to no longer automatically convert Number types (using.seconds
) toTime::Span
s, instead explicitly requiring them. This is a breaking change. To have this be deprecated instead, there should've been an additional method overload that did the automatic conversion with the@[Deprecated]
annotation.The text was updated successfully, but these errors were encountered: