Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove unused boost signals2 from torcontrol #28240

Merged
merged 5 commits into from
Aug 15, 2023

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Aug 8, 2023

Remove unused boost, and other includes, and other legacy functions from torcontrol.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 8, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK TheCharlatan, dergoegge, achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28101 (init: changing -torcontrol help to specify that a default port is used by kevkevinpal)
  • #27385 (net, refactor: extract Network and BIP155Network logic to node/network by jonatack)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot changed the title refactor: Remove unused boost signals2 from torcontrol refactor: Remove unused boost signals2 from torcontrol Aug 8, 2023
MarcoFalke added 2 commits August 8, 2023 16:03
No need for saturating behavior when the int is composed of 3 digits.
Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fa32af2

The async_handler was unused since its introduction, so I don't think it's worth it to keep it around.

#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <fcntl.h>// IWYU pragma: export
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: These pragmas could be indented like they are here: https://github.com/bitcoin/bitcoin/blob/master/src/util/strencodings.h#L20 , or did you omit any automatic formatting to maintain order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if the includes must come in a specific order. I've pushed a new commit to re-order them, which can be easily reverted, if there are issues.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change this to "These messages could be used to dispatch async notifications to an async handler"?

MarcoFalke added 2 commits August 8, 2023 17:47
Can be reviewed with:
--color-moved=blocks  --color-moved-ws=ignore-all-space --ignore-all-space
@TheCharlatan
Copy link
Contributor

Re-ACK faaba77

Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK faaba77

@maflcko maflcko requested a review from fanquake August 15, 2023 10:07

#include <event2/bufferevent.h>
#include <event2/event.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this (another) a bug in IWYU? Seems a bit weird to remove the <event2/event.h> include, which, as far as I can tell, is correct. It's where event_base is defined, and what is expected when using libevent:

section usage Standard usage
Every program that uses Libevent must include the <event2/event.h>
header, and pass the -levent flag to the linker.

Copy link
Member

@achow101 achow101 Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the since the libevent structs in this file are only pointers, the actual definitions aren't needed hence the include is not strictly necessary? It still compiles at least.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, iirc everything in libevent can be forward-declared except for evutil_socket_t. It's very annoying.

Because everything else is already forward-declared as @achow101 mentioned, only the definition of evutil_socket_t is needed. evutil_socket_t is actually defined in event2/util.h (note that event.h includes util.h.

So I agree with this change. It's a small reduction in needed includes.

@achow101
Copy link
Member

ACK faaba77

@achow101 achow101 merged commit b8ee2fa into bitcoin:master Aug 15, 2023
15 checks passed
@maflcko maflcko deleted the 2308-remove-boost-001- branch August 15, 2023 21:27
Copy link

@atou69 atou69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 17, 2023
…ontrol

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants