Comments (5)
Actually, I believe the correct and direct fix would be to move the original conversion from #system_connect
to #connect
:
--- 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 timeout
and deprecating the overload which is not Time::Span?
.
from crystal.
system_connect
is used by Socket#connect
, so this is a breaking change for it and its subclasses (IPSocket
, TCPSocket
, UDPSocket
, etc.)
from crystal.
We won't fix #system_connect
since it's undocumented internal API, but there should indeed be a deprecated override method for Socket#connect(addr, timeout = nil, &)
to not break the public API 👍
from crystal.
Crystal::System
is an internal implementation detail. So while this may be a breaking change, unless it affected some public API, it is allowed. Was how you discovered this using system_connect
directly or?
from crystal.
Thanks for reporting and fixing. Apparently this got lost in the heat of the moment.
from crystal.
Related Issues (20)
- Updating and Exposing more the LLVM API HOT 3
- Unaligned loads and stores
- Bug: Hash do not clean references to objects in `--release` mode HOT 1
- `LLVM::Builder` cannot be disposed
- `Pointer(T).malloc` for strict alignments
- `Indexable#each_index(&)` has different return types depending on overload
- Weird compilation error happening only on CI Github Action HOT 8
- Fail to compile in path with whitespace HOT 3
- Compiler error when output directory for object file is missing HOT 3
- It's impossible to create a regex that is MULTILINE but not DOT_ALL HOT 2
- Error: read before assignment to local variable '' HOT 2
- `Enumerable` method to find the first truthy block result and return that result HOT 8
- Macro Code Coverage
- `MacroIf` then/else missing location information HOT 1
- Doc error for Channel#close, Channel#close? when channel is buffered channel.
- Invalid memory access in release mode with LLVM 18 HOT 1
- `Number.new` causes `IndexError` with blank value and `whitespace: false`
- Ensuring `class_getter` runs exactly once under concurrent access HOT 3
- Methods with a return type of `self` automatically return `self` HOT 3
- Store annotations within the node they annotate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crystal.