Commit graph

9166 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
fanquake f4b9132d0c Update gitian build guide for Debian 8.1
Signed-off-by: fanquake <fanquake@gmail.com>
2015-09-03 15:51:37 +08: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
fanquake 42cf08905f depends: bump ccache to 3.2.3 2015-09-03 00:05:35 +08:00
fanquake 888c595cff depends: bump miniupnpc to 1.9.20150730 2015-09-03 00:05:35 +08: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
Altoidnerd 5b85126863 Update build-unix.md
If a user hasn't ready run autogen.sh, configure doesn't yet exist.  Do the instructions seem to presume you have already built bitcoin?  I don't think they do.

Would stifle beginners.

Update build-unix.md
2015-09-02 05:13:04 -04: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
Patrick Strateman 027de94e1f
Use network group instead of CNetAddr in final pass to select node to disconnect 2015-08-30 22:09:14 -07:00
Zak Wilcox 05179f7e9d Include bitcoin-tx binary on Debian/Ubuntu
Currently left out of Matt's PPA.  Debian's package for unstable already has it.
2015-08-29 18:52:44 +01: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
Patrick Strateman 000c18aace Fix comment 2015-08-25 16:31:13 -07:00
Patrick Strateman fed30940ef Acquire cs_vNodes before changing refrence counts 2015-08-25 16:30:02 -07:00
Patrick Strateman 69ee1aab00 CNodeRef copy constructor and assignment operator 2015-08-25 15:33:29 -07: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
Patrick Strateman dc81dd02a1 Return false early if vEvictionCandidates is empty 2015-08-22 15:38:24 -07:00
Patrick Strateman 17f3533c84 Better support for nodes with non-standard nMaxConnections 2015-08-22 15:38:24 -07:00
Patrick Strateman 1317cd1928 RAII wrapper for CNode* 2015-08-22 15:38:24 -07:00
Patrick Strateman df23937422 Add comments to AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman a8f6e45249 Remove redundant whiteconnections option 2015-08-22 15:38:24 -07:00
Patrick Strateman b105ba398b Prefer to disconnect peers in favor of whitelisted peers 2015-08-22 15:38:24 -07:00
Patrick Strateman 2c701537c8 AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman 4bac601610 Record nMinPingUsecTime 2015-08-22 15:38:23 -07:00
Patrick Strateman ae037b707c Refactor: Move failure conditions to the top of AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 1ef4817614 Refactor: Bail early in AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 541a1dd9e6 Refactor: AcceptConnection 2015-08-22 15:38:23 -07:00
Casey Rodarmor 0ce73985a8 Add p2p-fullblocktest.py 2015-08-21 15:31:37 -04:00