Move timeout properties to Socket
and IO::FileDescriptor
#14367
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Both
Socket
andIO::FileDescriptor
have publicread_timeout
andwrite_timeout
properties. For some reasons these ended up being defined inIO::Evented
(which is a shared module between the two, but only on Unix systems), andIO::Overlapped
(same job, but on Windows). That puts a general public API in places that are implementation-specific. The definitions are exactly identical, but they should never be duplicated in platform specific modules. They need to be defined in the public API space.This patch moves the definitions to
Socket
andIO::FileDescriptor
directly. This ends up still duplicated, but that's okay. Both types don't have any common ancestors except genericIO
. It's just coincidental that the internal implementation is shared.The code can also be simplified a by defining getters and setters with the
property
macro. That reduces the code a lot and leaves only the oddNumber
overloads (which might be good for deprecation? cf. #14368) preventing it from becoming a two-liner.