Commit Graph

17788 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
116503c0b8 Fix race condition between starting HTTP server thread and setting EventBase()
Split StartHTTPServer into InitHTTPServer and StartHTTPServer to give
clients a window to register their handlers without race conditions.

Thanks @ajweiss for figuring this out.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
9fb5b94e64 Document options for new HTTP/RPC server in --help 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
858afa1a4a Implement RPCTimerHandler for Qt RPC console
Implement RPCTimerHandler for Qt RPC console, so that `walletpassphrase`
works with GUI and `-server=0`.

Also simplify HTTPEvent-related code by using boost::function directly.

Zcash: QT changes ommitted
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
afd64f76ea evhttpd implementation
- *Replace usage of boost::asio with [libevent2](http://libevent.org/)*.
boost::asio is not part of C++11, so unlike other boost there is no
forwards-compatibility reason to stick with it. Together with #4738 (convert
json_spirit to UniValue), this rids Bitcoin Core of the worst offenders with
regard to compile-time slowness.

- *Replace spit-and-duct-tape http server with evhttp*. Front-end http handling
is handled by libevent, a work queue (with configurable depth and parallelism)
is used to handle application requests.

- *Wrap HTTP request in C++ class*; this makes the application code mostly
HTTP-server-neutral

- *Refactor RPC to move all http-specific code to a separate file*.
Theoreticaly this can allow building without HTTP server but with another RPC
backend, e.g. Qt's debug console (currently not implemented) or future RPC
mechanisms people may want to use.

- *HTTP dispatch mechanism*; services (e.g., RPC, REST) register which URL
paths they want to handle.

By using a proven, high-performance asynchronous networking library (also used
by Tor) and HTTP server, problems such as #5674, #5655, #344 should be avoided.

What works? bitcoind, bitcoin-cli, bitcoin-qt. Unit tests and RPC/REST tests
pass. The aim for now is everything but SSL support.

Configuration options:

- `-rpcthreads`: repurposed as "number of  work handler threads". Still
defaults to 4.

- `-rpcworkqueue`: maximum depth of work queue. When this is reached, new
requests will return a 500 Internal Error.

- `-rpctimeout`: inactivity time, in seconds, after which to disconnect a
client.

- `-debug=http`: low-level http activity logging
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
cc14ac45f4 tests: GET requests cannot have request body, use POST in rest.py
Sending a request body with GET request is not valid in HTTP spec, and
not compatible with evhttpd.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
df377ca82c build: build-system changes for libevent 2017-03-24 09:03:59 +13:00
Cory Fields
505b30ff01 libevent: add depends 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
72f52420ec Remove rpc_boostasiotocnetaddr test
Dropping all use of boost::asio.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
14dcc6ab96 qa: Remove -rpckeepalive tests from httpbasics
This option was a temporary workaround, and is no longer necessary
with the new web server.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
b6fbda0982 doc: remove documentation for rpcssl 2017-03-24 09:03:59 +13:00
Jack Grigg
bec25c91cb Revert "Closes #1680, temporary fix for rpc deadlock inherited from upstream."
This reverts commit f4404d7b5b.
2017-03-24 09:03:59 +13:00
jl777
a13fb56e55 Test 2017-03-23 21:40:31 +02:00
jl777
ad8796cf7c Test 2017-03-23 21:35:19 +02:00
jl777
f59302b668 Merge pull request #360 from jl777/dev
Check against pblock->nTime
2017-03-23 20:54:36 +02:00
jl777
628220bc5d Check against pblock->nTime 2017-03-23 20:54:07 +02:00
jl777
741b884ec6 Merge pull request #359 from jl777/dev
Dev
2017-03-23 20:48:48 +02:00
jl777
e40b78e93c Crash fix 2017-03-23 20:47:47 +02:00
jl777
e4f53bd20a Test 2017-03-23 20:23:25 +02:00
zkbot
7d9bf65501 Auto merge of #2168 - str4d:2164-getblock-anchor, r=daira
Add anchor to output of getblock

Closes #2164.
2017-03-23 18:21:10 +00:00
jl777
110696f9e1 Test 2017-03-23 20:09:55 +02:00
jl777
88e117ada6 Test 2017-03-23 20:09:07 +02:00
jl777
a2f017de08 Test 2017-03-23 20:05:02 +02:00
jl777
9b7233cf17 Test 2017-03-23 19:58:23 +02:00
jl777
944bf4b091 Test 2017-03-23 19:57:18 +02:00
jl777
0a0ec219d7 Test 2017-03-23 19:44:40 +02:00
jl777
da7775433d Test 2017-03-23 19:40:37 +02:00
jl777
6460b5b19c Test 2017-03-23 19:38:59 +02:00
zkbot
00e59e5935 Auto merge of #2175 - str4d:2074-txn-mempool, r=bitcartel
Bitcoin 0.12 mempool memory usage PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6410
- bitcoin/bitcoin#6453
- bitcoin/bitcoin#6013 (excludes changes to docs we deleted)

Part of #2074.
2017-03-23 17:29:35 +00:00
jl777
55d65e32ca Test 2017-03-23 19:26:19 +02:00
jl777
25d900ccd5 Merge pull request #358 from jl777/dev
Test
2017-03-23 18:37:56 +02:00
jl777
2ef1dfb6f1 Test 2017-03-23 18:35:11 +02:00
jl777
bf49cc6524 Merge pull request #357 from jl777/dev
Dev
2017-03-23 15:44:19 +02:00
jl777
89a2e5273c Test 2017-03-23 15:37:34 +02:00
jl777
9e8b81f637 Remove print 2017-03-23 14:20:16 +02:00
ca333
9fe0c0c126 Merge pull request #6 from jl777/master
master update
2017-03-23 11:34:53 +01:00
Jack Grigg
dec148f498 Fix prioritisetransaction RPC test
Part of #1884.
2017-03-23 18:57:46 +13:00
jl777
7674e37ff8 Merge pull request #356 from jl777/dPoW
DPoW
2017-03-23 07:29:18 +02:00
jl777
58d2e02b85 Merge pull request #355 from jl777/beta
Beta
2017-03-23 07:28:42 +02:00
jl777
cf3fe7e69e Merge pull request #354 from jl777/dev
Post-fork with mining
2017-03-23 07:26:26 +02:00
jl777
3fb7710470 Post-fork with mining 2017-03-23 07:25:53 +02:00
jl777
bee549f5a6 Merge pull request #353 from jl777/dev
Dev
2017-03-23 06:54:04 +02:00
jl777
253b7bc01d Test 2017-03-23 06:46:30 +02:00
jl777
3915943450 Test 2017-03-23 06:37:28 +02:00
jl777
7a57bbb446 Test 2017-03-23 06:28:05 +02:00
jl777
d5ecb91b00 Test 2017-03-23 06:21:21 +02:00
jl777
2d14730eeb Test 2017-03-23 06:17:53 +02:00
jl777
67cb4250ed Test 2017-03-23 05:53:28 +02:00
jl777
7ef5540bca Test 2017-03-23 05:47:19 +02:00
jl777
e9c0c24d5b Merge pull request #352 from jl777/dev
Test
2017-03-23 05:33:01 +02:00
jl777
fc901e2f4a Test 2017-03-23 05:31:12 +02:00