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()
358
358
359
359
// Redirect libevent's logging to our own log
360
360
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));
367
363
368
364
#ifdef WIN32
369
365
evthread_use_windows_threads ();
@@ -402,13 +398,12 @@ bool InitHTTPServer()
402
398
return true ;
403
399
}
404
400
405
- bool UpdateHTTPServerLogging (bool enable) {
401
+ void UpdateHTTPServerLogging (bool enable) {
406
402
if (enable) {
407
403
event_enable_debug_logging (EVENT_DBG_ALL);
408
404
} else {
409
405
event_enable_debug_logging (EVENT_DBG_NONE);
410
406
}
411
- return true ;
412
407
}
413
408
414
409
static std::thread g_thread_http;
Original file line number Diff line number Diff line change @@ -31,9 +31,8 @@ void InterruptHTTPServer();
31
31
/* * Stop HTTP server */
32
32
void StopHTTPServer ();
33
33
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);
37
36
38
37
/* * Handler for requests to a certain HTTP path */
39
38
typedef 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()
646
646
uint32_t changed_log_categories = original_log_categories ^ updated_log_categories;
647
647
648
648
// 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.
653
649
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));
660
651
}
661
652
662
653
UniValue result (UniValue::VOBJ);
You can’t perform that action at this time.
0 commit comments