|
|
@ -384,15 +384,13 @@ bool InitHTTPServer() |
|
|
|
|
|
|
|
|
|
|
|
// Redirect libevent's logging to our own log
|
|
|
|
// Redirect libevent's logging to our own log
|
|
|
|
event_set_log_callback(&libevent_log_cb); |
|
|
|
event_set_log_callback(&libevent_log_cb); |
|
|
|
#if LIBEVENT_VERSION_NUMBER >= 0x02010100 |
|
|
|
// Update libevent's log handling. Returns false if our version of
|
|
|
|
// If -debug=libevent, set full libevent debugging.
|
|
|
|
// libevent doesn't support debug logging, in which case we should
|
|
|
|
// Otherwise, disable all libevent debugging.
|
|
|
|
// clear the BCLog::LIBEVENT flag.
|
|
|
|
if (LogAcceptCategory(BCLog::LIBEVENT)) { |
|
|
|
if (!UpdateHTTPServerLogging(logCategories & BCLog::LIBEVENT)) { |
|
|
|
event_enable_debug_logging(EVENT_DBG_ALL); |
|
|
|
logCategories &= ~BCLog::LIBEVENT; |
|
|
|
} else { |
|
|
|
|
|
|
|
event_enable_debug_logging(EVENT_DBG_NONE); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef WIN32 |
|
|
|
#ifdef WIN32 |
|
|
|
evthread_use_windows_threads(); |
|
|
|
evthread_use_windows_threads(); |
|
|
|
#else |
|
|
|
#else |
|
|
@ -435,6 +433,20 @@ bool InitHTTPServer() |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool UpdateHTTPServerLogging(bool enable) { |
|
|
|
|
|
|
|
#if LIBEVENT_VERSION_NUMBER >= 0x02010100 |
|
|
|
|
|
|
|
if (enable) { |
|
|
|
|
|
|
|
event_enable_debug_logging(EVENT_DBG_ALL); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
event_enable_debug_logging(EVENT_DBG_NONE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
// Can't update libevent logging if version < 02010100
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::thread threadHTTP; |
|
|
|
std::thread threadHTTP; |
|
|
|
std::future<bool> threadResult; |
|
|
|
std::future<bool> threadResult; |
|
|
|
|
|
|
|
|
|
|
|