Skip to content

Commit

Permalink
merge bitcoin#28240: Remove unused boost signals2 from torcontrol
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Feb 14, 2025
1 parent 8e8faa2 commit 2980992
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
25 changes: 12 additions & 13 deletions src/compat/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions src/torcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@
#include <net.h>
#include <netaddress.h>
#include <netbase.h>
#include <random.h>
#include <tinyformat.h>
#include <util/check.h>
#include <util/readwritefile.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.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>
Expand Down Expand Up @@ -78,15 +89,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
Expand Down
11 changes: 2 additions & 9 deletions src/torcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@
#include <fs.h>
#include <netaddress.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;

Expand Down Expand Up @@ -83,8 +78,6 @@ class TorControlConnection
*/
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;
Expand Down

0 comments on commit 2980992

Please sign in to comment.