File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 9797test_test_bitcoin_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
9898test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS) $(EVENT_CFLAGS)
9999test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
100- $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS)
100+ $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
101101test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
102102if ENABLE_WALLET
103103test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
Original file line number Diff line number Diff line change 77#include " clientversion.h"
88#include " init.h"
99#include " validation.h"
10+ #include " httpserver.h"
1011#include " net.h"
1112#include " netbase.h"
1213#include " rpc/blockchain.h"
@@ -598,6 +599,20 @@ UniValue logging(const JSONRPCRequest& request)
598599 logCategories &= ~getCategoryMask (request.params[1 ]);
599600 }
600601
602+ // Update libevent logging if BCLog::LIBEVENT has changed.
603+ // If the library version doesn't allow it, UpdateHTTPServerLogging() returns false,
604+ // in which case we should clear the BCLog::LIBEVENT flag.
605+ // Throw an error if the user has explicitly asked to change only the libevent
606+ // flag and it failed.
607+ uint32_t changedLogCategories = originalLogCategories ^ logCategories;
608+ if (changedLogCategories & BCLog::LIBEVENT) {
609+ if (!UpdateHTTPServerLogging (logCategories & BCLog::LIBEVENT)) {
610+ logCategories &= ~BCLog::LIBEVENT;
611+ if (changedLogCategories == BCLog::LIBEVENT) {
612+ throw JSONRPCError (RPC_INVALID_PARAMETER, " libevent logging cannot be updated when using libevent before v2.1.1." );
613+ }
614+ }
615+ }
601616
602617 UniValue result (UniValue::VOBJ);
603618 std::vector<CLogCategoryActive> vLogCatActive = ListActiveLogCategories ();
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ bool fLogIPs = DEFAULT_LOGIPS;
118118std::atomic<bool > fReopenDebugLog (false );
119119CTranslationInterface translationInterface;
120120
121- /* * Log categories bitfield. libevent needs special handling if their flags are changed at runtime. */
121+ /* * Log categories bitfield. */
122122std::atomic<uint32_t > logCategories (0 );
123123
124124/* * Init OpenSSL library multithreading support */
You can’t perform that action at this time.
0 commit comments