File tree Expand file tree Collapse file tree 3 files changed +6
-21
lines changed Expand file tree Collapse file tree 3 files changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -358,12 +358,8 @@ bool InitHTTPServer()
358358
359359 // Redirect libevent's logging to our own log
360360 event_set_log_callback (&libevent_log_cb);
361- // Update libevent's log handling. Returns false if our version of
362- // libevent doesn't support debug logging, in which case we should
363- // clear the BCLog::LIBEVENT flag.
364- if (!UpdateHTTPServerLogging (LogInstance ().WillLogCategory (BCLog::LIBEVENT))) {
365- LogInstance ().DisableCategory (BCLog::LIBEVENT);
366- }
361+ // Update libevent's log handling.
362+ UpdateHTTPServerLogging (LogInstance ().WillLogCategory (BCLog::LIBEVENT));
367363
368364#ifdef WIN32
369365 evthread_use_windows_threads ();
@@ -402,13 +398,12 @@ bool InitHTTPServer()
402398 return true ;
403399}
404400
405- bool UpdateHTTPServerLogging (bool enable) {
401+ void UpdateHTTPServerLogging (bool enable) {
406402 if (enable) {
407403 event_enable_debug_logging (EVENT_DBG_ALL);
408404 } else {
409405 event_enable_debug_logging (EVENT_DBG_NONE);
410406 }
411- return true ;
412407}
413408
414409static std::thread g_thread_http;
Original file line number Diff line number Diff line change @@ -31,9 +31,8 @@ void InterruptHTTPServer();
3131/* * Stop HTTP server */
3232void StopHTTPServer ();
3333
34- /* * Change logging level for libevent. Removes BCLog::LIBEVENT from log categories if
35- * libevent doesn't support debug logging.*/
36- bool UpdateHTTPServerLogging (bool enable);
34+ /* * Change logging level for libevent. */
35+ void UpdateHTTPServerLogging (bool enable);
3736
3837/* * Handler for requests to a certain HTTP path */
3938typedef std::function<bool (HTTPRequest* req, const std::string &)> HTTPRequestHandler;
Original file line number Diff line number Diff line change @@ -646,17 +646,8 @@ static RPCHelpMan logging()
646646 uint32_t changed_log_categories = original_log_categories ^ updated_log_categories;
647647
648648 // Update libevent logging if BCLog::LIBEVENT has changed.
649- // If the library version doesn't allow it, UpdateHTTPServerLogging() returns false,
650- // in which case we should clear the BCLog::LIBEVENT flag.
651- // Throw an error if the user has explicitly asked to change only the libevent
652- // flag and it failed.
653649 if (changed_log_categories & BCLog::LIBEVENT) {
654- if (!UpdateHTTPServerLogging (LogInstance ().WillLogCategory (BCLog::LIBEVENT))) {
655- LogInstance ().DisableCategory (BCLog::LIBEVENT);
656- if (changed_log_categories == BCLog::LIBEVENT) {
657- throw JSONRPCError (RPC_INVALID_PARAMETER, " libevent logging cannot be updated when using libevent before v2.1.1." );
658- }
659- }
650+ UpdateHTTPServerLogging (LogInstance ().WillLogCategory (BCLog::LIBEVENT));
660651 }
661652
662653 UniValue result (UniValue::VOBJ);
You can’t perform that action at this time.
0 commit comments