Commit Graph
11692 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 df377ca82c build: build-system changes for libevent 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
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 628220bc5d Check against pblock->nTime 2017-03-23 20:54:07 +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 2ef1dfb6f1 Test 2017-03-23 18:35:11 +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
jl777 3fb7710470 Post-fork with mining 2017-03-23 07:25:53 +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 fc901e2f4a Test 2017-03-23 05:31:12 +02:00
Jack Grigg b7e5b7d5ee Simplify z_importkey by making rescan a string
Transparently handles older boolean values as well.
2017-03-23 15:57:11 +13:00
jl777 b11963b5b0 Test 2017-03-23 04:39:44 +02:00
jl777 43aafea7c9 Test 2017-03-23 04:32:03 +02:00
jl777 eca6ba0d9f Test 2017-03-23 04:29:57 +02:00
jl777 7f32cee639 Test 2017-03-23 04:23:54 +02:00
jl777 9f07c80c9f Test 2017-03-23 04:22:21 +02:00
Jack Grigg 493d8d81fb Expand on reasons for mining being paused 2017-03-23 15:16:04 +13:00
jl777 807949f42f Test 2017-03-23 04:05:11 +02:00
jl777 92266e9959 Test 2017-03-23 03:35:44 +02:00
jl777 c0dbb034f3 test 2017-03-23 03:30:15 +02:00
jl777 ba8419c7a0 Test 2017-03-23 03:20:32 +02:00
jl777 26d8ed58f6 Test 2017-03-23 03:10:07 +02:00
jl777 3683acba64 Test 2017-03-23 03:09:14 +02:00
Jack Grigg af370021a0 Metrics: Improve mining status 2017-03-23 14:08:36 +13:00
Jack Grigg dd20d04679 Metrics: Move local solution rate into stats 2017-03-23 14:08:33 +13:00