Skip to content

Commit b8ee2fa

Browse files
committed
Merge bitcoin/bitcoin#28240: refactor: Remove unused boost signals2 from torcontrol
faaba77 Sort includes in compat.h (MarcoFalke) fa91a23 remove unused limits.h include in compat.h (MarcoFalke) fa32af2 Replace LocaleIndependentAtoi with ToIntegral (MarcoFalke) faab76c iwyu on torcontrol (MarcoFalke) fa0a60d 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 faaba77 achow101: ACK faaba77 dergoegge: utACK faaba77 Tree-SHA512: 440f8d3ae9c3cf4dcc368e35b29459b5fcec8c6d233e8f9be3a854e7624b8633d6ccdde10cb0c6f74f86278e06557c4e9e24de30c3c692826237939265c6160a
2 parents b97b050 + faaba77 commit b8ee2fa

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

src/compat/compat.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@
2222
#include <ws2tcpip.h>
2323
#include <cstdint>
2424
#else
25-
#include <fcntl.h>
26-
#include <sys/mman.h>
27-
#include <sys/select.h>
28-
#include <sys/socket.h>
29-
#include <sys/types.h>
30-
#include <net/if.h>
31-
#include <netinet/in.h>
32-
#include <netinet/tcp.h>
33-
#include <arpa/inet.h>
34-
#include <ifaddrs.h>
35-
#include <limits.h>
36-
#include <netdb.h>
37-
#include <unistd.h>
25+
#include <arpa/inet.h> // IWYU pragma: export
26+
#include <fcntl.h> // IWYU pragma: export
27+
#include <ifaddrs.h> // IWYU pragma: export
28+
#include <net/if.h> // IWYU pragma: export
29+
#include <netdb.h> // IWYU pragma: export
30+
#include <netinet/in.h> // IWYU pragma: export
31+
#include <netinet/tcp.h> // IWYU pragma: export
32+
#include <sys/mman.h> // IWYU pragma: export
33+
#include <sys/select.h> // IWYU pragma: export
34+
#include <sys/socket.h> // IWYU pragma: export
35+
#include <sys/types.h> // IWYU pragma: export
36+
#include <unistd.h> // IWYU pragma: export
3837
#endif
3938

4039
// We map Linux / BSD error functions and codes, to the equivalent

src/torcontrol.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,26 @@
1414
#include <net.h>
1515
#include <netaddress.h>
1616
#include <netbase.h>
17+
#include <random.h>
18+
#include <tinyformat.h>
19+
#include <util/check.h>
20+
#include <util/fs.h>
1721
#include <util/readwritefile.h>
1822
#include <util/strencodings.h>
23+
#include <util/string.h>
1924
#include <util/thread.h>
2025
#include <util/time.h>
2126

27+
#include <algorithm>
28+
#include <cassert>
29+
#include <cstdlib>
2230
#include <deque>
2331
#include <functional>
32+
#include <map>
33+
#include <optional>
2434
#include <set>
35+
#include <thread>
36+
#include <utility>
2537
#include <vector>
2638

2739
#include <event2/buffer.h>
@@ -79,15 +91,15 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
7991
if (s.size() < 4) // Short line
8092
continue;
8193
// <status>(-|+| )<data><CRLF>
82-
self->message.code = LocaleIndependentAtoi<int>(s.substr(0,3));
94+
self->message.code = ToIntegral<int>(s.substr(0, 3)).value_or(0);
8395
self->message.lines.push_back(s.substr(4));
8496
char ch = s[3]; // '-','+' or ' '
8597
if (ch == ' ') {
8698
// Final line, dispatch reply and clean up
8799
if (self->message.code >= 600) {
100+
// (currently unused)
88101
// Dispatch async notifications to async handler
89102
// Synchronous and asynchronous messages are never interleaved
90-
self->async_handler(*self, self->message);
91103
} else {
92104
if (!self->reply_handlers.empty()) {
93105
// Invoke reply handler with message

src/torcontrol.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@
1111
#include <netaddress.h>
1212
#include <util/fs.h>
1313

14-
#include <boost/signals2/signal.hpp>
14+
#include <event2/util.h>
1515

16-
#include <event2/bufferevent.h>
17-
#include <event2/event.h>
18-
19-
#include <cstdlib>
16+
#include <cstdint>
2017
#include <deque>
2118
#include <functional>
2219
#include <string>
2320
#include <vector>
2421

25-
class CService;
26-
2722
extern const std::string DEFAULT_TOR_CONTROL;
2823
static const bool DEFAULT_LISTEN_ONION = true;
2924

@@ -83,8 +78,6 @@ class TorControlConnection
8378
*/
8479
bool Command(const std::string &cmd, const ReplyHandlerCB& reply_handler);
8580

86-
/** Response handlers for async replies */
87-
boost::signals2::signal<void(TorControlConnection &,const TorControlReply &)> async_handler;
8881
private:
8982
/** Callback when ready for use */
9083
std::function<void(TorControlConnection&)> connected;

0 commit comments

Comments
 (0)