-
Notifications
You must be signed in to change notification settings - Fork 848
Add UnixSocket class based on SocketManager #11479
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
Conversation
786ba06 to
6d2f481
Compare
UnixSocket Class The new class is a thin wrapper for a Unix socket file descriptor. It does not manage the resource itself, although this would be a good idea for a future improvement. Removed Functions Some functions are not applicable to sockets and do not belong in a utility for managing sockets. The functions open, pwrite, lseek and fsync were not transferred to the new class. The function socket() was replaced by a UnixSocket constructor. API Changes The file descriptor no longer needs to be passed because it is remembered by the UnixSocket object. Some parameters that were unused are removed from the new interface. There is no longer a socket() function; instead a UnixSocket constructor with the same arguments is provided. Implementation Changes Other than small cleanups like changing uint64_t to std::uint64_t and constifying arguments, all implementations are directly copied from the old SocketManager ones except for client_fastopen_supported. It was refactored to improve naming and make the use of the bitmask obvious. Performance Considerations Since the class is a thin wrapper, there should be no performance overhead from the use of a class. All methods that were declared inline in a header for UnixSocket are also declared inline in the UnixSocket.h header. There could be a small increase in compile times because there is no separate P_UnixSocket.h header, but UnixSocket.h is private to inkevent so far, so the compilation time difference should be negligible.
6d2f481 to
74d925c
Compare
|
imo we should NOT use TS_INLINE for new code. Just use |
* Replace TS_INLINE with inline
|
What's the responsibility of SocketManager? Do we still need it? |
|
@maskit Nope, although we have to find a home for the |
|
An option for |
|
The |
You are right. I somehow mixed up the two, and I meant |
We decided to leave transient_error where it is because it is specific to the UnixSocket implementation and will not likely be useful anywhere else.
* Add a method to check whether socket creation succeeded.
|
I have added a function |
UnixSocket Class
The new class is a thin wrapper for a Unix socket file descriptor. It does
not manage the resource itself, although this would be a good idea for a
future improvement.
Removed Functions
Some functions are not applicable to sockets and do not belong in a utility
for managing sockets. The functions open, pwrite, lseek and fsync were not
transferred to the new class. The function socket() was replaced by a
UnixSocket constructor.
API Changes
The file descriptor no longer needs to be passed because it is remembered
by the UnixSocket object. Some parameters that were unused are removed
from the new interface. There is no longer a socket() function; instead
a UnixSocket constructor with the same arguments is provided.
Implementation Changes
Other than small cleanups like changing uint64_t to std::uint64_t and
constifying parameters, all implementations are directly copied from
the old SocketManager ones except for client_fastopen_supported. It
was refactored to improve naming and make the use of the bitmask obvious.
Performance Considerations
Since the class is a thin wrapper, there should be no performance overhead
from the use of a class. All methods that were declared inline in a header
for UnixSocket are also declared inline in the UnixSocket.h header. There
could be a small increase in compile times because there is no separate
P_UnixSocket.h header, but UnixSocket.h is private to inkevent so far, so
the compilation time difference should be negligible.