Improve private field names.
This commit is contained in:
parent
b799390efa
commit
106797f7f0
@ -103,7 +103,7 @@ StringBuilder &operator<<(StringBuilder &sb, const PrintFlags &print_flags) {
|
||||
namespace detail {
|
||||
class FileFdImpl {
|
||||
public:
|
||||
PollableFdInfo info;
|
||||
PollableFdInfo info_;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
@ -242,8 +242,8 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
|
||||
|
||||
FileFd FileFd::from_native_fd(NativeFd native_fd) {
|
||||
auto impl = make_unique<detail::FileFdImpl>();
|
||||
impl->info.set_native_fd(std::move(native_fd));
|
||||
impl->info.add_flags(PollFlags::Write());
|
||||
impl->info_.set_native_fd(std::move(native_fd));
|
||||
impl->info_.add_flags(PollFlags::Write());
|
||||
return FileFd(std::move(impl));
|
||||
}
|
||||
|
||||
@ -648,11 +648,11 @@ Status FileFd::truncate_to_current_position(int64 current_position) {
|
||||
}
|
||||
PollableFdInfo &FileFd::get_poll_info() {
|
||||
CHECK(!empty());
|
||||
return impl_->info;
|
||||
return impl_->info_;
|
||||
}
|
||||
const PollableFdInfo &FileFd::get_poll_info() const {
|
||||
CHECK(!empty());
|
||||
return impl_->info;
|
||||
return impl_->info_;
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -43,7 +43,7 @@ namespace detail {
|
||||
#if TD_PORT_WINDOWS
|
||||
class SocketFdImpl final : private Iocp::Callback {
|
||||
public:
|
||||
explicit SocketFdImpl(NativeFd native_fd) : info(std::move(native_fd)) {
|
||||
explicit SocketFdImpl(NativeFd native_fd) : info_(std::move(native_fd)) {
|
||||
VLOG(fd) << get_native_fd() << " create from native_fd";
|
||||
get_poll_info().add_flags(PollFlags::Write());
|
||||
Iocp::get()->subscribe(get_native_fd(), this);
|
||||
@ -51,7 +51,7 @@ class SocketFdImpl final : private Iocp::Callback {
|
||||
notify_iocp_connected();
|
||||
}
|
||||
|
||||
SocketFdImpl(NativeFd native_fd, const IPAddress &addr) : info(std::move(native_fd)) {
|
||||
SocketFdImpl(NativeFd native_fd, const IPAddress &addr) : info_(std::move(native_fd)) {
|
||||
VLOG(fd) << get_native_fd() << " create from native_fd and connect";
|
||||
get_poll_info().add_flags(PollFlags::Write());
|
||||
Iocp::get()->subscribe(get_native_fd(), this);
|
||||
@ -88,14 +88,14 @@ class SocketFdImpl final : private Iocp::Callback {
|
||||
}
|
||||
|
||||
PollableFdInfo &get_poll_info() {
|
||||
return info;
|
||||
return info_;
|
||||
}
|
||||
const PollableFdInfo &get_poll_info() const {
|
||||
return info;
|
||||
return info_;
|
||||
}
|
||||
|
||||
const NativeFd &get_native_fd() const {
|
||||
return info.native_fd();
|
||||
return info_.native_fd();
|
||||
}
|
||||
|
||||
Result<size_t> write(Slice data) {
|
||||
@ -161,7 +161,7 @@ class SocketFdImpl final : private Iocp::Callback {
|
||||
}
|
||||
|
||||
private:
|
||||
PollableFdInfo info;
|
||||
PollableFdInfo info_;
|
||||
SpinLock lock_;
|
||||
|
||||
std::atomic<int> refcnt_{1};
|
||||
@ -335,7 +335,7 @@ class SocketFdImpl final : private Iocp::Callback {
|
||||
void on_close() {
|
||||
VLOG(fd) << get_native_fd() << " on close";
|
||||
close_flag_ = true;
|
||||
info.set_native_fd({});
|
||||
info_.set_native_fd({});
|
||||
}
|
||||
bool dec_refcnt() {
|
||||
VLOG(fd) << get_native_fd() << " dec_refcnt from " << refcnt_;
|
||||
@ -386,18 +386,18 @@ static InitWSA init_wsa;
|
||||
#else
|
||||
class SocketFdImpl {
|
||||
public:
|
||||
PollableFdInfo info;
|
||||
explicit SocketFdImpl(NativeFd fd) : info(std::move(fd)) {
|
||||
PollableFdInfo info_;
|
||||
explicit SocketFdImpl(NativeFd fd) : info_(std::move(fd)) {
|
||||
}
|
||||
PollableFdInfo &get_poll_info() {
|
||||
return info;
|
||||
return info_;
|
||||
}
|
||||
const PollableFdInfo &get_poll_info() const {
|
||||
return info;
|
||||
return info_;
|
||||
}
|
||||
|
||||
const NativeFd &get_native_fd() const {
|
||||
return info.native_fd();
|
||||
return info_.native_fd();
|
||||
}
|
||||
|
||||
Result<size_t> writev(Span<IoSlice> slices) {
|
||||
|
@ -29,7 +29,7 @@ namespace td {
|
||||
namespace detail {
|
||||
class EventFdLinuxImpl {
|
||||
public:
|
||||
PollableFdInfo info;
|
||||
PollableFdInfo info_;
|
||||
};
|
||||
|
||||
EventFdLinux::EventFdLinux() = default;
|
||||
@ -42,7 +42,7 @@ void EventFdLinux::init() {
|
||||
auto eventfd_errno = errno;
|
||||
LOG_IF(FATAL, !fd) << Status::PosixError(eventfd_errno, "eventfd call failed");
|
||||
impl_ = make_unique<EventFdLinuxImpl>();
|
||||
impl_->info.set_native_fd(std::move(fd));
|
||||
impl_->info_.set_native_fd(std::move(fd));
|
||||
}
|
||||
|
||||
bool EventFdLinux::empty() {
|
||||
@ -58,14 +58,14 @@ Status EventFdLinux::get_pending_error() {
|
||||
}
|
||||
|
||||
PollableFdInfo &EventFdLinux::get_poll_info() {
|
||||
return impl_->info;
|
||||
return impl_->info_;
|
||||
}
|
||||
|
||||
// NB: will be called from multiple threads
|
||||
void EventFdLinux::release() {
|
||||
const uint64 value = 1;
|
||||
auto slice = Slice(reinterpret_cast<const char *>(&value), sizeof(value));
|
||||
auto native_fd = impl_->info.native_fd().fd();
|
||||
auto native_fd = impl_->info_.native_fd().fd();
|
||||
|
||||
auto result = [&]() -> Result<size_t> {
|
||||
auto write_res = detail::skip_eintr([&] { return write(native_fd, slice.begin(), slice.size()); });
|
||||
@ -86,7 +86,7 @@ void EventFdLinux::release() {
|
||||
}
|
||||
|
||||
void EventFdLinux::acquire() {
|
||||
impl_->info.sync_with_poll();
|
||||
impl_->info_.sync_with_poll();
|
||||
SCOPE_EXIT {
|
||||
// Clear flags without EAGAIN and EWOULDBLOCK
|
||||
// Looks like it is safe thing to do with eventfd
|
||||
@ -94,7 +94,7 @@ void EventFdLinux::acquire() {
|
||||
};
|
||||
uint64 res;
|
||||
auto slice = MutableSlice(reinterpret_cast<char *>(&res), sizeof(res));
|
||||
auto native_fd = impl_->info.native_fd().fd();
|
||||
auto native_fd = impl_->info_.native_fd().fd();
|
||||
auto result = [&]() -> Result<size_t> {
|
||||
CHECK(!slice.empty());
|
||||
auto read_res = detail::skip_eintr([&] { return ::read(native_fd, slice.begin(), slice.size()); });
|
||||
|
Loading…
Reference in New Issue
Block a user