aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | rpc: work-around an upstream libevent bugCory Fields2017-11-011-2/+26
| | | | | | | | | | | | | | A rare race condition may trigger while awaiting the body of a message, see upsteam commit 5ff8eb26371c4dc56f384b2de35bea2d87814779 for details. This may fix some reported rpc hangs/crashes.
* | Merge #11006: Improve shutdown processWladimir J. van der Laan2017-10-181-0/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 793667a Improve shutdown process (João Barbosa) Pull request description: Improve the shutdown time by not having to wait up to 2 seconds. Here is a comparison running `wallet.py` function tests before this PR: ``` 2017-08-08 03:25:20.881000 TestFramework (INFO): Initializing test directory /var/folders/1v/8_69hby54nj2k3n6fywt44x80000gn/T/testq_ramjjr 2017-08-08 03:25:23.853000 TestFramework (INFO): Mining blocks... 2017-08-08 03:25:24.132000 TestFramework (INFO): test getmemoryinfo 2017-08-08 03:25:24.559000 TestFramework (INFO): test gettxout 2017-08-08 03:25:59.858000 TestFramework (INFO): check -rescan 2017-08-08 03:26:07.735000 TestFramework (INFO): check -reindex 2017-08-08 03:26:15.751000 TestFramework (INFO): check -zapwallettxes=1 2017-08-08 03:26:24.105000 TestFramework (INFO): check -zapwallettxes=2 2017-08-08 03:26:36.694000 TestFramework (INFO): Stopping nodes 2017-08-08 03:26:43.599000 TestFramework (INFO): Cleaning up 2017-08-08 03:26:43.612000 TestFramework (INFO): Tests successful ``` After: ``` 2017-08-08 03:24:04.319000 TestFramework (INFO): Initializing test directory /var/folders/1v/8_69hby54nj2k3n6fywt44x80000gn/T/testoqeyi50_ 2017-08-08 03:24:07.035000 TestFramework (INFO): Mining blocks... 2017-08-08 03:24:07.317000 TestFramework (INFO): test getmemoryinfo 2017-08-08 03:24:07.763000 TestFramework (INFO): test gettxout 2017-08-08 03:24:25.715000 TestFramework (INFO): check -rescan 2017-08-08 03:24:27.792000 TestFramework (INFO): check -reindex 2017-08-08 03:24:29.797000 TestFramework (INFO): check -zapwallettxes=1 2017-08-08 03:24:32.207000 TestFramework (INFO): check -zapwallettxes=2 2017-08-08 03:24:36.812000 TestFramework (INFO): Stopping nodes 2017-08-08 03:24:37.915000 TestFramework (INFO): Cleaning up 2017-08-08 03:24:37.927000 TestFramework (INFO): Tests successful ``` This largely improves the time spent in Travis (under evaluation). Tree-SHA512: 023012fb3f8a380addf5995a4bf865862fed712cdd1a648d82a710e6566bc3bd34b6c49f9f06d6cc6bd81ca859da50d30d7f786c816e702549ab642e3476426f
| * Improve shutdown processJoão Barbosa2017-08-121-0/+2
| |
* | Merge #10809: optim: mark a few classes finalWladimir J. van der Laan2017-08-211-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 40a0f9f Enable devirtualization opportunities by using the final specifier (C++11) (practicalswift) 9a1675e optim: mark a few classes final (Cory Fields) Pull request description: Using gcc's ```-Wsuggest-final-types``` and lto, I identified a few easy devirtualization wins: > wallet/wallet.h:651:7: warning: Declaring type 'struct CWallet' final would enable devirtualization of 26 calls [-Wsuggest-final-types] >coins.h:201:7: warning: Declaring type 'struct CCoinsViewCache' final would enable devirtualization of 13 calls [-Wsuggest-final-types] >txdb.h:67:7: warning: Declaring type 'struct CCoinsViewDB' final would enable devirtualization of 5 calls [-Wsuggest-final-types] >zmq/zmqnotificationinterface.h:16:7: warning: Declaring type 'struct CZMQNotificationInterface' final would enable devirtualization of 4 calls [-Wsuggest-final-types] >httpserver.cpp:42:7: warning: Declaring type 'struct HTTPWorkItem' final would enable devirtualization of 2 calls [-Wsuggest-final-types] Tree-SHA512: 2a825fd27121ccabaacff5cde2fc8a50d1b4cc846374606caa2a71b0cd8fcb0d3c9b5b3fd342d944998610e2168048601278f8a3709cc515191a0bb2d98ba782
| * | optim: mark a few classes finalCory Fields2017-07-171-1/+1
| | |
* | | Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-2/+2
| | | | | | | | | | | | In order to avoid unintended implicit conversions.
* | | Use nullptr instead of zero (0) as the null pointer constantpracticalswift2017-08-161-7/+7
| | |
* | | Merge #10705: Trivial: spelling fixesMarcoFalke2017-08-161-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f42fc1d50 doc: spelling fixes (klemens) Pull request description: patch contains some spelling fixes ( just in comments ) as found by a bot ( http://www.misfix.org, https://github.com/ka7/misspell_fixer ). Tree-SHA512: ba6046cfcd81b0783420daae7d776be92dd7b85a593e212f8f1b4403aca9b1b6af12cef7080d4ea5ed4a14952fd25e4300109a59c414e08f5395cdb9947bb750
| * | | doc: spelling fixesklemens2017-08-161-1/+1
| | | |
* | | | scripted-diff: stop using the gArgs wrappersMarko Bencun2017-08-141-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They were temporary additions to ease the transition. -BEGIN VERIFY SCRIPT- find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g' -END VERIFY SCRIPT-
* | | | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-8/+8
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* | | Add wallet endpoint support to bitcoin-cli (-usewallet)Jonas Schnelli2017-07-171-0/+11
| |/ |/|
* | [refactor] move SplitHostPort() into utilstrencodingsJohn Newbery2017-07-121-0/+1
|/ | | | | This moves SplitHostPort from libbitcoin_common to libbitcoin_util so it is available to bitcoin-cli.
* Use the override specifier (C++11) where we expect to be overriding the ↵practicalswift2017-06-281-1/+1
| | | | virtual function of a base class
* Indentation after 'Remove redundant calls to gArgs.IsArgSet()'Jorge Timón2017-06-271-9/+9
|
* Util: Remove redundant calls to gArgs.IsArgSet()Jorge Timón2017-06-271-3/+1
| | | | | Return empty std::vector<std::string> with ArgsManager::GetArgs if nothing is set for that string
* Merge #9517: [refactor] Switched httpserver.cpp to use RAII wrapped libevents.Wladimir J. van der Laan2017-06-221-16/+8
|\ | | | | | | | | | | | | 1ae86ec Changed event RAII helper functions to inline to deal with duplicate symbol linker errors. (Karl-Johan Alm) fd369d2 Switched httpserver.cpp to use RAII wrapped libevents. (Kalle Alm) Tree-SHA512: 877e431f211024d42a3b0800e860e02833398611433e8393f8d5d4970f47f4bd670b900443678c067fec110c087aaab7dc1981ccbf17f6057676fdbbda89aed9
| * Switched httpserver.cpp to use RAII wrapped libevents.Kalle Alm2017-03-221-16/+8
| |
* | Util: Small improvements in gArgs usageJorge Timón2017-05-091-5/+3
| | | | | | | | | | - Don't check gArgs.IsArgSet() is greater than 0 - Remove unneeded calls and local variables
* | scripted-diff: Util: Encapsulate mapMultiArgs behind gArgsJorge Timón2017-05-091-4/+4
| | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/mapMultiArgs.count(/gArgs.IsArgSet(/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; sed -i 's/mapMultiArgs.at("/gArgs.GetArgs("/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* | Set BCLog::LIBEVENT correctly for old libevent versions.John Newbery2017-04-101-8/+20
| |
* | Change LogAcceptCategory to use uint32_t rather than sets of strings.Gregory Maxwell2017-04-011-18/+19
|/ | | | | | | | | | | | | | | | | This changes the logging categories to boolean flags instead of strings. This simplifies the acceptance testing by avoiding accessing a scoped static thread local pointer to a thread local set of strings. It eliminates the only use of boost::thread_specific_ptr outside of lockorder debugging. This change allows log entries to be directed to multiple categories and makes it easy to change the logging flags at runtime (e.g. via an RPC, though that isn't done by this commit.) It also eliminates the fDebug global. Configuration of unknown logging categories now produces a warning.
* Merge #10027: Set to nullptr after deleteWladimir J. van der Laan2017-03-201-0/+1
|\ | | | | | | | | | | d93b97f Set to nullptr after delete (practicalswift) Tree-SHA512: 7201cef4541557ffe31f52ce7527c4b08a2ff5aa1eae5268bdfee5b4843881f8fd115257bef6d1b4dfb71166951950a912ce87aef160ca89c2ca2ae264cfab1b
| * Set to nullptr after deletepracticalswift2017-03-181-0/+1
| |
* | Remove unused codepracticalswift2017-03-171-7/+0
|/
* Access WorkQueue::running only within the cs lock.Matt Corallo2017-02-031-1/+1
| | | | | This removes a "race" between Interrupt() and Run(), though it should not effect any of our supported platforms.
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Introduce (and use) an IsArgSet accessor methodMatt Corallo2016-12-231-2/+2
|
* Fix non-const mapMultiArgs[] access after init.Matt Corallo2016-12-231-3/+3
| | | | | Swap mapMultiArgs for a const-reference to a _mapMultiArgs which is only accessed in util.cpp
* Merge #8109: Do not shadow member variablesPieter Wuille2016-08-261-9/+9
|\ | | | | | | ff8d279 Do not shadow member variables (Pavel Janík)
| * Do not shadow member variablesPavel Janík2016-07-311-9/+9
| |
* | net: fixup nitsCory Fields2016-08-121-1/+1
| |
* | net: Have LookupNumeric return a CService directlyCory Fields2016-08-041-1/+1
| | | | | | | | | | | | Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
* | net: Split resolving out of CSubNetCory Fields2016-07-311-3/+8
| |
* | net: Split resolving out of CServiceCory Fields2016-07-311-1/+1
|/
* httpserver: replace boost threads with stdCory Fields2016-07-281-21/+18
| | | | | | | | | along with mutex/condvar/bind/etc. httpserver handles its own interruption, so there's no reason not to use std threading. While we're at it, may as well kill the BOOST_FOREACH's as well.
* httpserver: explicitly detach worker threadsCory Fields2016-07-281-2/+4
| | | | | | | | | | When using std::thread in place of boost::thread, letting the threads destruct results in a std::terminate. According to the docs, the same thing should be be happening in later boost versions: http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.destructor I'm unsure why this hasn't blown up already, but explicitly detaching can't hurt.
* httpserver: use a future rather than relying on boost's try_join_forCory Fields2016-07-281-8/+9
|
* http: use std::move to move HTTPRequest into HTTPWorkItemWladimir J. van der Laan2016-05-051-3/+3
| | | | Thanks to Cory Fields for the idea.
* http: Change boost::scoped_ptr to std::unique_ptr in HTTPRequestWladimir J. van der Laan2016-05-051-2/+1
| | | | No need for boost here.
* http: Add log message when work queue is fullWladimir J. van der Laan2016-05-051-1/+3
| | | | More useful error reporting.
* http: Do a pending c++11 simplificationWladimir J. van der Laan2016-05-051-11/+5
| | | | | | | Use std::unique_ptr for handling work items. This makes the code more RAII and, as mentioned in the comment, is what I planned when I wrote the code in the first place.
* auto_ptr → unique_ptrWladimir J. van der Laan2016-04-281-2/+2
| | | | | | | 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.
* move rpc* to rpc/Daniel Cousens2016-01-211-1/+1
|
* http: add Boost 1.49 compatibilityWladimir J. van der Laan2015-11-201-0/+4
| | | | | | | | | | | | | `try_join_for` was introduced in Boost 1.50: http://www.boost.org/doc/libs/1_50_0/doc/html/thread/thread_management.html#thread.thread_management.thread.try_join_for 1.49 has `timed_join`, one can accomplish the same with: http://www.boost.org/doc/libs/1_49_0/doc/html/thread/thread_management.html#thread.thread_management.thread.timed_join However, `timed_join` was deprecated in 1.50. So a conditional is necessary. This solution was tested in #7031.
* Avoid a compile error on hosts with libevent too old for EVENT_LOG_WARN.Gregory Maxwell2015-11-161-0/+4
| | | | | This uses _EVENT_LOG_WARN instead, which appears to be defined in the old versions of libevent that I have on some systems.
* http: speed up shutdownWladimir J. van der Laan2015-11-131-10/+20
| | | | | | | | | | | | | | | | | | | | This continues/fixes #6719. `event_base_loopbreak` was not doing what I expected it to, at least in libevent 2.0.21. What I expected was that it sets a timeout, given that no other pending events it would exit in N seconds. However, what it does was delay the event loop exit with 10 seconds, even if nothing is pending. Solve it in a different way: give the event loop thread time to exit out of itself, and if it doesn't, send loopbreak. This speeds up the RPC tests a lot, each exit incurred a 10 second overhead, with this change there should be no shutdown overhead in the common case and up to two seconds if the event loop is blocking. As a bonus this breaks dependency on boost::thread_group, as the HTTP server minds its own offspring.
* http: Restrict maximum size of request line + headersWladimir J. van der Laan2015-10-201-0/+4
| | | | | | | Prevent memory exhaustion by sending lots of data. Also add a test to `httpbasics.py`. Closes #6425
* http: Force-exit event loop after predefined timeWladimir J. van der Laan2015-09-281-0/+7
| | | | | | This makes sure that the event loop eventually terminates, even if an event (like an open timeout, or a hanging connection) happens to be holding it up.
* http: Wait for worker threads to exitWladimir J. van der Laan2015-09-281-3/+37
| | | | | | | | | | | | | | | | | Add a WaitExit() call to http's WorkQueue to make it delete the work queue only when all worker threads stopped. This fixes a problem that was reproducable by pressing Ctrl-C during AppInit2: ``` /usr/include/boost/thread/pthread/condition_variable_fwd.hpp:81: boost::condition_variable::~condition_variable(): Assertion `!ret' failed. /usr/include/boost/thread/pthread/mutex.hpp:108: boost::mutex::~mutex(): Assertion `!posix::pthread_mutex_destroy(&m)' failed. ``` I was assuming that `threadGroup->join_all();` would always have been called when entering the Shutdown(). However this is not the case in bitcoind's AppInit2-non-zero-exit case "was left out intentionally here".