Commit Graph

10483 Commits

Author SHA1 Message Date
jl777
d54aa57df4 Test 2017-03-24 01:41:11 +02:00
jl777
fa0a031c09 Test 2017-03-24 01:33:47 +02:00
jl777
58bec1f9b5 Test 2017-03-24 01:27:03 +02:00
jl777
7d44d3dddd Test 2017-03-24 01:19:53 +02:00
jl777
88416f2bc9 Test 2017-03-24 01:04:18 +02:00
jl777
e20babf1df Test 2017-03-24 01:01:49 +02:00
jl777
5ead8b4e85 Test 2017-03-24 00:55:19 +02:00
jl777
a710762818 Test 2017-03-24 00:51:12 +02:00
jl777
ad0b9d6237 Test 2017-03-24 00:47:51 +02:00
jl777
7fc4dca5eb Test 2017-03-24 00:36:23 +02:00
jl777
28c39e54b6 Test 2017-03-24 00:28:42 +02:00
jl777
8795f3397f Test 2017-03-24 00:23:47 +02:00
jl777
48b72e1725 Test 2017-03-24 00:16:18 +02:00
jl777
1a85595b5a Test 2017-03-24 00:14:38 +02:00
jl777
9f539d8804 Test 2017-03-24 00:13:52 +02:00
jl777
b575c4fb7b Test 2017-03-24 00:08:11 +02:00
jl777
c2123afed9 Test 2017-03-23 23:58:39 +02:00
jl777
52e5ebfdc2 Test 2017-03-23 23:22:08 +02:00
jl777
3fd98f8ff6 Test 2017-03-23 23:21:02 +02:00
jl777
9a9b36ca7e Test 2017-03-23 23:20:31 +02:00
jl777
b9551735cf Test 2017-03-23 23:07:51 +02:00
jl777
b2d09a90d4 Test 2017-03-23 22:46:42 +02:00
jl777
10c862f271 Test 2017-03-23 22:32:48 +02:00
jl777
4110a59a43 Test 2017-03-23 22:15:29 +02:00
Ian Kelling
629a875229 Docs: add details to -rpcclienttimeout doc 2017-03-24 09:03:59 +13:00
Luke Dashjr
c65969a5a6 Skip RAII event tests if libevent is built without event_set_mem_functions 2017-03-24 09:03:59 +13:00
Karl-Johan Alm
ca50af75b1 Added EVENT_CFLAGS to test makefile to explicitly include libevent headers. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm
e8b6d84b9f Added some simple tests for the RAII-style events. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm
68377e18a8 Switched bitcoin-cli.cpp to use RAII unique pointers with deleters. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm
17fb609097 Added std::unique_ptr<> wrappers with deleters for libevent modules. 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
7c2ab05969 bitcoin-cli: Make error message less confusing
Sorry for the churn on this, but the current message (introduced in #9073)
isn't acceptable:

    $ src/bitcoin-cli getinfo
    rpc: couldn't connect to server
    (make sure server is running and you are connecting to the correct RPC port: -1 unknown)

Putting the error code after the words "RPC port" made me wonder whether
there was a port configuration issue.

This changes it to:

    $ src/bitcoin-cli getinfo
    error: couldn't connect to server: unknown (code -1)
    (make sure server is running and you are connecting to the correct RPC port)
2017-03-24 09:03:59 +13:00
instagibbs
603205e381 Add common failure cases for rpc server connection failure 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
6415573a59 bitcoin-cli: More detailed error reporting
Register a evhttp error handler to get a more detailed error message
if the HTTP request fails.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
08c581940a auto_ptr → unique_ptr
Change the few occurrences of the deprecated `auto_ptr` to c++11 `unique_ptr`.
Silences the deprecation warnings.

Also add a missing `std::` for consistency.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
0e2b1ae259 chain: define enum used as bit field as uint32_t
Bitwise logic combined with `<` with undefined signedness will
potentially results in undefined behavior. Fix this by defining the type
as a c++11 typed enum.

Fixes #6017.
2017-03-24 09:03:59 +13:00
Gregory Maxwell
599d2c4034 Avoid a compile error on hosts with libevent too old for EVENT_LOG_WARN.
This uses _EVENT_LOG_WARN instead, which appears to be defined in the
 old versions of libevent that I have on some systems.
2017-03-24 09:03:59 +13:00
Bob McElrath
c922edd00f Add explicit shared_ptr constructor due to C++11 error 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
89bccddcd8 rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout
The two timeouts for the server and client, are essentially different:

- In the case of the server it should be a lower value to avoid clients
clogging up connection slots

- In the case of the client it should be a high value to accomedate slow
  responses from the server, for example for slow queries or when the
  lock is contended

Split the options into `-rpcservertimeout` and `-rpcclienttimeout` with
respective defaults of 30 and 900.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
a659991a2c http: Disable libevent debug logging, if not explicitly enabled
Add a option "-debug=libevent" to enable libevent debugging for troubleshooting.
Libevent logging is redirected to our own log.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
7ed4d40c61 init: Ignore SIGPIPE
Ignore SIGPIPE on all non-win32 OSes, otherwise an unexpectedly disconnecting
RPC client will terminate the application. This problem was introduced
with the libhttp-based RPC server.

Fixes #6660.
2017-03-24 09:03:59 +13:00
Jack Grigg
077ddc1187 Add libevent to zcash-gtest 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan
167b6231c9 Move windows socket init to utility function 2017-03-24 09:03:59 +13:00
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