diff options
author | Andrew Chow <github@achow101.com> | 2023-08-15 17:09:17 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-08-15 17:21:54 -0400 |
commit | b8ee2fa02ef5cb6a559c5f459ce7215ed9f6e15c (patch) | |
tree | 2b9c47727dab32c0de2e9c0350c6fc036d66221c /src | |
parent | b97b05048d8899d1df7ff67679dc18436a42609b (diff) | |
parent | faaba770e11352ddf6414b9855f4baa46a967580 (diff) |
Merge bitcoin/bitcoin#28240: refactor: Remove unused boost signals2 from torcontrol
faaba770e11352ddf6414b9855f4baa46a967580 Sort includes in compat.h (MarcoFalke)
fa91a23d63dcbf222bd70d05ed49cf1f8e4edce0 remove unused limits.h include in compat.h (MarcoFalke)
fa32af22b323e7c58b6b20af6517f4795a72cdc5 Replace LocaleIndependentAtoi with ToIntegral (MarcoFalke)
faab76c1c01e6d3fff8ac1bc71baeecd8846dc32 iwyu on torcontrol (MarcoFalke)
fa0a60dd93e4485c1f62ffcc87fa9e6b195ce795 Remove unused boost signals2 from torcontrol (MarcoFalke)
Pull request description:
Remove unused boost, and other includes, and other legacy functions from torcontrol.
ACKs for top commit:
TheCharlatan:
Re-ACK faaba770e11352ddf6414b9855f4baa46a967580
achow101:
ACK faaba770e11352ddf6414b9855f4baa46a967580
dergoegge:
utACK faaba770e11352ddf6414b9855f4baa46a967580
Tree-SHA512: 440f8d3ae9c3cf4dcc368e35b29459b5fcec8c6d233e8f9be3a854e7624b8633d6ccdde10cb0c6f74f86278e06557c4e9e24de30c3c692826237939265c6160a
Diffstat (limited to 'src')
-rw-r--r-- | src/compat/compat.h | 25 | ||||
-rw-r--r-- | src/torcontrol.cpp | 16 | ||||
-rw-r--r-- | src/torcontrol.h | 11 |
3 files changed, 28 insertions, 24 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h index 8195bceaec..435a403552 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -22,19 +22,18 @@ #include <ws2tcpip.h> #include <cstdint> #else -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/select.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <net/if.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <ifaddrs.h> -#include <limits.h> -#include <netdb.h> -#include <unistd.h> +#include <arpa/inet.h> // IWYU pragma: export +#include <fcntl.h> // IWYU pragma: export +#include <ifaddrs.h> // IWYU pragma: export +#include <net/if.h> // IWYU pragma: export +#include <netdb.h> // IWYU pragma: export +#include <netinet/in.h> // IWYU pragma: export +#include <netinet/tcp.h> // IWYU pragma: export +#include <sys/mman.h> // IWYU pragma: export +#include <sys/select.h> // IWYU pragma: export +#include <sys/socket.h> // IWYU pragma: export +#include <sys/types.h> // IWYU pragma: export +#include <unistd.h> // IWYU pragma: export #endif // We map Linux / BSD error functions and codes, to the equivalent diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index a8d6fb4b3f..9cf976a700 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -14,14 +14,26 @@ #include <net.h> #include <netaddress.h> #include <netbase.h> +#include <random.h> +#include <tinyformat.h> +#include <util/check.h> +#include <util/fs.h> #include <util/readwritefile.h> #include <util/strencodings.h> +#include <util/string.h> #include <util/thread.h> #include <util/time.h> +#include <algorithm> +#include <cassert> +#include <cstdlib> #include <deque> #include <functional> +#include <map> +#include <optional> #include <set> +#include <thread> +#include <utility> #include <vector> #include <event2/buffer.h> @@ -79,15 +91,15 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx) if (s.size() < 4) // Short line continue; // <status>(-|+| )<data><CRLF> - self->message.code = LocaleIndependentAtoi<int>(s.substr(0,3)); + self->message.code = ToIntegral<int>(s.substr(0, 3)).value_or(0); self->message.lines.push_back(s.substr(4)); char ch = s[3]; // '-','+' or ' ' if (ch == ' ') { // Final line, dispatch reply and clean up if (self->message.code >= 600) { + // (currently unused) // Dispatch async notifications to async handler // Synchronous and asynchronous messages are never interleaved - self->async_handler(*self, self->message); } else { if (!self->reply_handlers.empty()) { // Invoke reply handler with message diff --git a/src/torcontrol.h b/src/torcontrol.h index afc5413db0..1a9065b01a 100644 --- a/src/torcontrol.h +++ b/src/torcontrol.h @@ -11,19 +11,14 @@ #include <netaddress.h> #include <util/fs.h> -#include <boost/signals2/signal.hpp> +#include <event2/util.h> -#include <event2/bufferevent.h> -#include <event2/event.h> - -#include <cstdlib> +#include <cstdint> #include <deque> #include <functional> #include <string> #include <vector> -class CService; - extern const std::string DEFAULT_TOR_CONTROL; static const bool DEFAULT_LISTEN_ONION = true; @@ -83,8 +78,6 @@ public: */ bool Command(const std::string &cmd, const ReplyHandlerCB& reply_handler); - /** Response handlers for async replies */ - boost::signals2::signal<void(TorControlConnection &,const TorControlReply &)> async_handler; private: /** Callback when ready for use */ std::function<void(TorControlConnection&)> connected; |