Fix some includes.

GitOrigin-RevId: 9b36a638202fb8b34e13494efd6b4a48ff7f4845
This commit is contained in:
levlam 2018-09-10 04:08:15 +03:00
parent a2846362a0
commit fc0cbae579
32 changed files with 57 additions and 25 deletions

View File

@ -13,8 +13,8 @@
#include "td/utils/crypto.h"
#include "td/utils/logging.h"
#include "td/utils/MpscPollableQueue.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/Poll.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/thread.h"
#include <atomic>

View File

@ -26,10 +26,10 @@
#include "td/utils/JsonBuilder.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/detail/Pollable.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/signals.h"
#include "td/utils/port/SocketFd.h"
#include "td/utils/port/Stat.h"
#include "td/utils/port/StdStreams.h"
#include "td/utils/port/thread_local.h"

View File

@ -18,8 +18,8 @@
#include "td/utils/MimeType.h"
#include "td/utils/misc.h"
#include "td/utils/PathView.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/Status.h"
namespace td {

View File

@ -17,8 +17,8 @@
#include "td/utils/MpscPollableQueue.h"
#include "td/utils/ObjectPool.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/EventFd.h"
#include "td/utils/port/Poll.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/thread_local.h"
#include "td/utils/Slice.h"
#include "td/utils/type_traits.h"

View File

@ -15,6 +15,7 @@
#include "td/utils/MpscPollableQueue.h"
#include "td/utils/ObjectPool.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/Slice.h"
#include <atomic>

View File

@ -13,6 +13,7 @@
#include "td/actor/Timeout.h"
#include "td/utils/logging.h"
#include "td/utils/MpscPollableQueue.h"
#include "td/utils/Observer.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/thread.h"

View File

@ -15,6 +15,7 @@
#include "td/utils/misc.h"
#include "td/utils/port/Clocks.h"
#include "td/utils/port/path.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/Stat.h"
#include "td/utils/Random.h"
#include "td/utils/ScopeGuard.h"

View File

@ -7,11 +7,13 @@
#pragma once
#include "td/utils/buffer.h"
#include "td/utils/logging.h"
#include "td/utils/optional.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/thread_local.h"
#include "td/utils/port/UdpSocketFd.h"
#include "td/utils/Span.h"
#include "td/utils/Status.h"
#include "td/utils/VectorQueue.h"
#include <array>

View File

@ -7,6 +7,7 @@
#pragma once
#include "td/utils/int_types.h"
#include "td/utils/logging.h"
#include "td/utils/Random.h"
#include <functional>

View File

@ -17,7 +17,7 @@
namespace td {
namespace format {
/*** HexDump ***/
template <std::size_t size, bool reversed = true>
template <std::size_t size, bool is_reversed = true>
struct HexDumpSize {
const unsigned char *data;
};
@ -26,12 +26,12 @@ inline char hex_digit(int x) {
return "0123456789abcdef"[x];
}
template <std::size_t size, bool reversed>
StringBuilder &operator<<(StringBuilder &builder, const HexDumpSize<size, reversed> &dump) {
template <std::size_t size, bool is_reversed>
StringBuilder &operator<<(StringBuilder &builder, const HexDumpSize<size, is_reversed> &dump) {
const unsigned char *ptr = dump.data;
// TODO: append unsafe
for (std::size_t i = 0; i < size; i++) {
int xy = ptr[reversed ? size - 1 - i : i];
int xy = ptr[is_reversed ? size - 1 - i : i];
int x = xy >> 4;
int y = xy & 15;
builder << hex_digit(x) << hex_digit(y);

View File

@ -23,7 +23,6 @@
#include <errno.h>
#include <atomic>
#include <type_traits>
#endif
namespace td {

View File

@ -16,6 +16,7 @@
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/sleep.h"
#include "td/utils/StringBuilder.h"

View File

@ -7,6 +7,7 @@
#pragma once
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollFlags.h"
namespace td {
class PollBase {

View File

@ -10,6 +10,7 @@
#include "td/utils/logging.h"
#include "td/utils/port/IPAddress.h"
#include "td/utils/port/PollFlags.h"
#if TD_PORT_POSIX
@ -29,6 +30,7 @@
#include "td/utils/VectorQueue.h"
#endif
#include <atomic>
#include <cstring>
namespace td {

View File

@ -8,6 +8,7 @@
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/PollFlags.h"
#if TD_PORT_WINDOWS
#include "td/utils/buffer.h"
@ -26,6 +27,7 @@
#include <unistd.h>
#endif
#include <atomic>
#include <cstring>
namespace td {

View File

@ -64,10 +64,10 @@ class SocketFd {
explicit SocketFd(std::unique_ptr<detail::SocketFdImpl> impl);
};
namespace detail {
#if TD_PORT_POSIX
namespace detail {
Status get_socket_pending_error(const NativeFd &fd);
#endif
} // namespace detail
#endif
} // namespace td

View File

@ -10,11 +10,13 @@
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/SocketFd.h"
#include "td/utils/VectorQueue.h"
#if TD_PORT_WINDOWS
#include "td/utils/port/detail/WineventPoll.h"
#include "td/utils/SpinLock.h"
#endif
#if TD_PORT_POSIX
@ -32,6 +34,7 @@
#endif // TD_PORT_POSIX
#include <array>
#include <atomic>
#include <cstring>
namespace td {
@ -97,21 +100,21 @@ class UdpSocketSendHelper {
class UdpSocketFdImpl : private IOCP::Callback {
public:
explicit UdpSocketFdImpl(NativeFd fd) : info(std::move(fd)) {
explicit UdpSocketFdImpl(NativeFd fd) : info_(std::move(fd)) {
get_poll_info().add_flags(PollFlags::Write());
IOCP::get()->subscribe(get_native_fd(), this);
is_receive_active_ = true;
notify_iocp_connected();
}
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();
}
void close() {
@ -149,7 +152,7 @@ class UdpSocketFdImpl : private IOCP::Callback {
}
private:
PollableFdInfo info;
PollableFdInfo info_;
SpinLock lock_;
std::atomic<int> refcnt_{1};
@ -322,7 +325,7 @@ class UdpSocketFdImpl : private IOCP::Callback {
void on_close() {
VLOG(fd) << get_native_fd().io_handle() << " on close";
close_flag_ = true;
info.set_native_fd({});
info_.set_native_fd({});
}
bool dec_refcnt() {
@ -467,17 +470,17 @@ class UdpSocketSendHelper {
class UdpSocketFdImpl {
public:
explicit UdpSocketFdImpl(NativeFd fd) : info(std::move(fd)) {
explicit UdpSocketFdImpl(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();
}
Status get_pending_error() {
if (get_poll_info().get_flags().has_pending_error()) {
@ -638,7 +641,7 @@ class UdpSocketFdImpl {
}
private:
PollableFdInfo info;
PollableFdInfo info_;
Status send_messages_slow(Span<UdpSocketFd::OutboundMessage> messages, size_t &cnt) {
cnt = 0;

View File

@ -11,8 +11,10 @@
#ifdef TD_POLL_EPOLL
#include "td/utils/common.h"
#include "td/utils/List.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/port/PollFlags.h"
#include <sys/epoll.h>

View File

@ -12,6 +12,7 @@ char disable_linker_warning_about_empty_file_event_fd_bsd_cpp TD_UNUSED;
#include "td/utils/logging.h"
#include "td/utils/port/detail/NativeFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/SocketFd.h"
#include "td/utils/Slice.h"

View File

@ -13,6 +13,7 @@ char disable_linker_warning_about_empty_file_event_fd_linux_cpp TD_UNUSED;
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/detail/NativeFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/Slice.h"
#include <sys/eventfd.h>

View File

@ -10,6 +10,8 @@ char disable_linker_warning_about_empty_file_event_fd_windows_cpp TD_UNUSED;
#ifdef TD_EVENTFD_WINDOWS
#include "td/utils/logging.h"
namespace td {
namespace detail {

View File

@ -11,8 +11,10 @@
#ifdef TD_POLL_KQUEUE
#include "td/utils/common.h"
#include "td/utils/List.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/port/PollFlags.h"
#include <cstdint>

View File

@ -11,6 +11,7 @@
#include "td/utils/common.h"
#include "td/utils/MovableValue.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
namespace td {
@ -59,7 +60,6 @@ class NativeFd {
#endif
};
class StringBuilder;
StringBuilder &operator<<(StringBuilder &sb, const NativeFd &fd);
} // namespace td

View File

@ -13,6 +13,7 @@
#include "td/utils/common.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/port/PollFlags.h"
#include <poll.h>

View File

@ -8,12 +8,14 @@
#include "td/utils/format.h"
#include "td/utils/List.h"
#include "td/utils/logging.h"
#include "td/utils/Observer.h"
#include "td/utils/port/detail/NativeFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/SpinLock.h"
#include <atomic>
#include <type_traits>
namespace td {

View File

@ -13,6 +13,7 @@
#include "td/utils/common.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/port/PollFlags.h"
#include <sys/select.h>

View File

@ -12,7 +12,6 @@ char disable_linker_warning_about_empty_file_wineventpoll_cpp TD_UNUSED;
#include "td/utils/common.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/Status.h"

View File

@ -15,7 +15,9 @@
#include "td/utils/port/detail/NativeFd.h"
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/PollBase.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/thread.h"
#include "td/utils/Status.h"
namespace td {
namespace detail {

View File

@ -6,6 +6,8 @@
//
#include "td/utils/port/path.h"
#include "td/utils/port/detail/PollableFd.h"
#if TD_WINDOWS
#include "td/utils/Random.h"
#endif

View File

@ -7,6 +7,7 @@
#include "td/utils/tests.h"
#include "td/utils/buffer.h"
#include "td/utils/Random.h"
using namespace td;

View File

@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/utils/common.h"
#include "td/utils/logging.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/path.h"
#include "td/utils/Slice.h"

View File

@ -25,6 +25,7 @@
#include "td/utils/port/detail/PollableFd.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/path.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/thread_local.h"
#include "td/utils/Random.h"
#include "td/utils/Slice.h"