Commit Graph

8940 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 3a174cd400 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.
2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 6d2bc22146 Document options for new HTTP/RPC server in --help 2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan be33f3f50b 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.
2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 57d85d9bee doc: mention SSL support dropped for RPC in release notes 2015-09-03 10:59:19 +02:00
Wladimir J. van der Laan 40b556d374 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
2015-09-03 10:59:18 +02:00
Wladimir J. van der Laan ee2a42b447 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.
2015-09-02 18:38:42 +02:00
Cory Fields 6e996d39da tests: fix qt payment test
Now that boost no longer automatically initializes openssl, we have to
do it ourselves.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 3140ef9249 build: build-system changes for libevent 2015-09-02 18:38:41 +02:00
Cory Fields a9af234c1f libevent: add depends 2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 6a21dd598c Remove rpc_boostasiotocnetaddr test
Dropping all use of boost::asio.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 8f9301cdaa qa: Remove -rpckeepalive tests from httpbasics
This option was a temporary workaround, and is no longer necessary
with the new web server.
2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 51fcfc022c doc: remove documentation for rpcssl 2015-09-02 18:38:41 +02:00
Wladimir J. van der Laan 3932ff50c5
Merge pull request #6620
10e469a travis: bump wine to 1.7 (Cory Fields)
2015-09-02 18:38:10 +02:00
Cory Fields 10e469ae37 travis: bump wine to 1.7 2015-09-02 11:42:27 -04:00
Wladimir J. van der Laan b319f0828e
Merge pull request #6617
bfadae3 travis: for travis generating an extra build (Cory Fields)
2015-09-02 17:14:29 +02:00
Cory Fields bfadae3374 travis: for travis generating an extra build 2015-09-01 21:45:23 -04:00
Wladimir J. van der Laan 10c0e52b68
Merge pull request #6548
060058e Enable python tests for Native Windows (ptschip)
2015-09-01 11:37:13 +02:00
Wladimir J. van der Laan af9305a7e8
Merge pull request #6583
9f3e48e add support for miniupnpc api version 14 (Pavel Vasin)
2015-08-31 17:38:07 +02:00
Wladimir J. van der Laan f4d88c4041
Merge pull request #6599
9bebf60 Make sure LogPrint strings are line-terminated (J Ross Nicoll)
2015-08-31 11:56:18 +02:00
J Ross Nicoll 9bebf60698
Make sure LogPrint strings are line-terminated 2015-08-29 17:40:13 +01:00
ptschip 060058e955 Enable python tests for Native Windows
1) Multiplatorm support for devnull
2) Fixed a bug in the handling of cache files
3) Deleted run-bitcoin-cli as no longer needed
2015-08-26 10:59:22 -07:00
Wladimir J. van der Laan ea19c2bc3f
Merge pull request #6530
c33c11e Improve addrman Select() performance when buckets are nearly empty (Pieter Wuille)
2015-08-26 17:58:40 +02:00
Wladimir J. van der Laan 981fd92bc5
Merge pull request #6590
bd30c3d rpc-tests: re-enable rpc-tests for Windows (Cory Fields)
a193387 net: Set SO_REUSEADDR for Windows too (Cory Fields)
2015-08-26 12:06:08 +02:00
Pieter Wuille c33c11ebac Improve addrman Select() performance when buckets are nearly empty 2015-08-26 01:59:09 +02:00
Cory Fields bd30c3dced rpc-tests: re-enable rpc-tests for Windows 2015-08-25 12:03:28 -04:00
Cory Fields a19338723d net: Set SO_REUSEADDR for Windows too
When running the rpc tests in Wine, nodes often fail to listen on localhost
due to a stale socket from a previous run. This aligns the behavior with other
platforms.
2015-08-25 11:31:06 -04:00
Wladimir J. van der Laan da9beb288d
Merge pull request #6576
e938122 Stop parsing JSON after first finished construct. (Daniel Kraft)
2015-08-24 13:44:05 +02:00
Wladimir J. van der Laan 561f8af450
Merge pull request #6523
0ce7398 Add p2p-fullblocktest.py (Casey Rodarmor)
2015-08-24 13:25:49 +02:00
Pavel Vasin 9f3e48e521 add support for miniupnpc api version 14
The value of new arg ttl is set to 2 as it's recommended default.
2015-08-23 23:53:49 +03:00
Casey Rodarmor 0ce73985a8 Add p2p-fullblocktest.py 2015-08-21 15:31:37 -04:00
Wladimir J. van der Laan 49793fbb09
Merge pull request #6541
e0862c0 Reformat validateaddress help, add missing iswatchonly description. (Pavel Janík)
2015-08-21 12:35:20 +02:00
Wladimir J. van der Laan e3f13ddc54
Merge pull request #6242
17221bf chainparams: don't use std namespace (Cory Fields)
f0deec5 chainparams: move CCheckpointData into chainparams.h (Cory Fields)
2015-08-20 18:26:26 +02:00
Wladimir J. van der Laan e128464bc5
Merge pull request #6545
8be371d Do not store more than 200 timedata samples. (Pavel Janík)
2015-08-20 17:13:52 +02:00
Wladimir J. van der Laan 70ec975ea6
Merge pull request #6556
1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos)
bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
2015-08-20 16:45:46 +02:00
Wladimir J. van der Laan 5e6e0898a1
Merge pull request #6571
1d1073c consensus: cache the openssl EC_GROUP to avoid a race condition for each CECKey instantiation (Cory Fields)
2015-08-20 16:33:50 +02:00
Daniel Kraft e938122b7b Stop parsing JSON after first finished construct.
Fix https://github.com/bitcoin/bitcoin/issues/6558.  In particular, stop
parsing JSON after the first object or array is finished.  Check that no
other garbage follows, and fail the parser if it does.
2015-08-20 12:48:43 +02:00
Alex Morcos 1123cdbf4d add unit test for CNetAddr::GetGroup. 2015-08-19 17:06:42 -04:00
Cory Fields 1d1073c2d3 consensus: cache the openssl EC_GROUP to avoid a race condition for each CECKey instantiation 2015-08-19 14:25:01 -04:00
Wladimir J. van der Laan ef30389e2a
Merge pull request #6544
c5c1edf Fix spelling mistake in -> if. (Mark Friedenbach)
e846b2a Correct a possibly intentional pun that is nevertheless hard to read: "two times of nLockTime." What is meant is that there are two kinds, or categories of nLockTime. (Mark Friedenbach)
2015-08-19 17:37:52 +02:00
Wladimir J. van der Laan 80cddbbba9
Merge pull request #6539
9f68ed6 typofixes (found by misspell_fixer) (Veres Lajos)
2015-08-19 17:28:00 +02:00
Wladimir J. van der Laan a6f2affde8
Merge pull request #6565
fb08d92 Make sure we re-acquire lock if a task throws (Casey Rodarmor)
2015-08-19 16:27:40 +02:00
Wladimir J. van der Laan e08a7d9d40
Merge pull request #6561
7bd57bb Add limitedmap test (Casey Rodarmor)
8b06894 Disallow unlimited limited maps (Casey Rodarmor)
fd2d862 Make limited map actually respect max size (Casey Rodarmor)
2015-08-19 15:45:14 +02:00
Wladimir J. van der Laan 0f0f323c9a
Merge pull request #6567
2016576 Fix crash when mining with empty keypool. (Daniel Kraft)
2015-08-19 15:07:38 +02:00
Casey Rodarmor fb08d92312 Make sure we re-acquire lock if a task throws 2015-08-18 10:40:13 -04:00
Daniel Kraft 2016576998 Fix crash when mining with empty keypool.
Since the introduction of the ScriptForMining callback, the mining
functions (setgenerate and generate) crash with an assertion failure
(due to a NULL pointer script returned) if the keypool is empty.  Fix
this by giving a proper error.
2015-08-18 09:07:33 +02:00
Casey Rodarmor 7bd57bb1d7 Add limitedmap test 2015-08-17 12:15:32 -04:00
Casey Rodarmor 8b06894194 Disallow unlimited limited maps 2015-08-17 12:15:32 -04:00
Casey Rodarmor fd2d862fbc Make limited map actually respect max size 2015-08-17 12:15:32 -04:00
Wladimir J. van der Laan 1e92b27540
Merge pull request #6553
183b8fb Add missing files to files.md (fanquake)
2015-08-17 17:06:24 +02:00
Wladimir J. van der Laan 39ddaeb8fe
Merge pull request #6551
243b80d Handle leveldb::DestroyDB() errors on wipe failure (Adam Weiss)
2015-08-17 16:52:57 +02:00