Page MenuHomePhabricator

Add HTTP callback args wrapper to support multiple args
AbandonedPublic

Authored by jasonbcox on Aug 8 2018, 21:23.

Details

Reviewers
deadalnix
schancel
Group Reviewers
Restricted Project
Summary

Prep so we can pass RPCServer (doesn't exist yet) through the HTTP callbacks system.

Test Plan

make check
test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
httpserver
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3041
Build 4174: Bitcoin ABC Buildbot (legacy)
Build 4173: arc lint + arc unit

Event Timeline

src/httpserver.cpp
386

Why is this a global? Can't we just pass it into initHTTPServer from AppInit() or main()

schancel requested changes to this revision.Aug 21 2018, 16:58
This revision now requires changes to proceed.Aug 21 2018, 16:58

Pass around httpCallbackArgs instead of using a global

deadalnix requested changes to this revision.Aug 24 2018, 08:28

I do not get why httpCallbackArgs need to passed around everywhere ? It seems like it's completely unnecessary in many places and redundant with the config.

src/init.cpp
1115 ↗(On Diff #4621)

Do not pass both config and HTTPCallbackArgs, there is redundant info in there.

src/init.h
9 ↗(On Diff #4621)

You only manipulate HTTPCallbackArgs by ref, so just forward declare.

This revision now requires changes to proceed.Aug 24 2018, 08:28
jasonbcox added inline comments.
src/httpserver.cpp
386

Following the call chain, it's something like this:

// init.cpp (this is fine):
InitHTTPServer() <- AppInitServers() <- AppInitMain()

// bitcoind.cpp (this is fine):
AppInitMain() <- AppInit()

// qt/bitcoin.cpp (this is where things start to get messy):
AppInitMain() <- initialize()
// which is called from this in the same file:
connect(this, SIGNAL(requestedInitialize(Config *)), executor,
            SLOT(initialize(Config *)));

I made the choice to not modify too much of the qt wallet code, as it's likely to add a lot of dev time to refactoring the RPC server code. Let me know what you think.

src/init.cpp
1115 ↗(On Diff #4621)

We cleared this up offline. It appears redundant, but removing one or the other breaks encapsulation. The HTTP code uses config, but should not have to dip into the HTTPCallbackArgs to find them. HTTPCallbackArgs is constructed only for the the HTTP callbacks and no other purpose.

Fixed according to feedback

Since D1736 and D1721 are working without this change, I will likely abandon this diff.