Add proxy methods to maximize socket buffers
This commit is contained in:
parent
27d105ef51
commit
98a24f41aa
@ -369,4 +369,12 @@ Result<ServerSocketFd> ServerSocketFd::open(int32 port, CSlice addr) {
|
||||
return ServerSocketFd(std::move(impl));
|
||||
}
|
||||
|
||||
Result<uint32> ServerSocketFd::maximize_snd_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_snd_buffer(max_size);
|
||||
}
|
||||
|
||||
Result<uint32> ServerSocketFd::maximize_rcv_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_rcv_buffer(max_size);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -33,6 +33,9 @@ class ServerSocketFd {
|
||||
ServerSocketFd &operator=(ServerSocketFd &&) noexcept;
|
||||
~ServerSocketFd();
|
||||
|
||||
Result<uint32> maximize_snd_buffer(uint32 max_size = 0);
|
||||
Result<uint32> maximize_rcv_buffer(uint32 max_size = 0);
|
||||
|
||||
static Result<ServerSocketFd> open(int32 port, CSlice addr = CSlice("0.0.0.0")) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
PollableFdInfo &get_poll_info();
|
||||
|
@ -717,4 +717,12 @@ Result<size_t> SocketFd::read(MutableSlice slice) {
|
||||
return impl_->read(slice);
|
||||
}
|
||||
|
||||
Result<uint32> SocketFd::maximize_snd_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_snd_buffer(max_size);
|
||||
}
|
||||
|
||||
Result<uint32> SocketFd::maximize_rcv_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_rcv_buffer(max_size);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -37,6 +37,9 @@ class SocketFd {
|
||||
SocketFd &operator=(SocketFd &&) noexcept;
|
||||
~SocketFd();
|
||||
|
||||
Result<uint32> maximize_snd_buffer(uint32 max_size = 0);
|
||||
Result<uint32> maximize_rcv_buffer(uint32 max_size = 0);
|
||||
|
||||
static Result<SocketFd> open(const IPAddress &address) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
PollableFdInfo &get_poll_info();
|
||||
|
@ -822,4 +822,12 @@ bool UdpSocketFd::is_critical_read_error(const Status &status) {
|
||||
return status.code() == ENOMEM || status.code() == ENOBUFS;
|
||||
}
|
||||
|
||||
Result<uint32> UdpSocketFd::maximize_snd_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_snd_buffer(max_size);
|
||||
}
|
||||
|
||||
Result<uint32> UdpSocketFd::maximize_rcv_buffer(uint32 max_size) {
|
||||
return get_native_fd().maximize_rcv_buffer(max_size);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -44,6 +44,9 @@ class UdpSocketFd {
|
||||
UdpSocketFd(const UdpSocketFd &) = delete;
|
||||
UdpSocketFd &operator=(const UdpSocketFd &) = delete;
|
||||
|
||||
Result<uint32> maximize_snd_buffer(uint32 max_size = 0);
|
||||
Result<uint32> maximize_rcv_buffer(uint32 max_size = 0);
|
||||
|
||||
static Result<UdpSocketFd> open(const IPAddress &address) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
PollableFdInfo &get_poll_info();
|
||||
|
Loading…
Reference in New Issue
Block a user