mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +00:00
RequestServer: Don't hide the SIGINFO state dump behind a debug macro
Until we're confident that RequestServer doesn't need this runtime debug dump helper, it's much nicer if everyone has it built in, so they can simply send a SIGINFO if they see it acting up.
This commit is contained in:
parent
3db847c64a
commit
77f0e57b27
Notes:
sideshowbarker
2024-07-18 03:13:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/77f0e57b27b
|
@ -338,10 +338,6 @@
|
|||
#cmakedefine01 REGEX_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef REQUEST_SERVER_DEBUG
|
||||
#cmakedefine01 REQUEST_SERVER_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef RESIZE_DEBUG
|
||||
#cmakedefine01 RESIZE_DEBUG
|
||||
#endif
|
||||
|
|
|
@ -141,7 +141,6 @@ set(PTHREAD_DEBUG ON)
|
|||
set(PTMX_DEBUG ON)
|
||||
set(REACHABLE_DEBUG ON)
|
||||
set(REGEX_DEBUG ON)
|
||||
set(REQUEST_SERVER_DEBUG ON)
|
||||
set(RESIZE_DEBUG ON)
|
||||
set(RESOURCE_DEBUG ON)
|
||||
set(ROUTING_DEBUG ON)
|
||||
|
|
|
@ -37,8 +37,7 @@ void request_did_finish(URL const& url, Core::Socket const* socket)
|
|||
auto& connection = *connection_it;
|
||||
if (connection->request_queue.is_empty()) {
|
||||
connection->has_started = false;
|
||||
if constexpr (REQUEST_SERVER_DEBUG)
|
||||
connection->current_url = {};
|
||||
connection->current_url = {};
|
||||
connection->removal_timer->on_timeout = [ptr = connection.ptr(), &cache_entry = *it->value, key = it->key, &cache]() mutable {
|
||||
Core::deferred_invoke([&, key = move(key), ptr] {
|
||||
dbgln("Removing no-longer-used connection {} (socket {})", ptr, ptr->socket);
|
||||
|
@ -63,10 +62,8 @@ void request_did_finish(URL const& url, Core::Socket const* socket)
|
|||
}
|
||||
dbgln("Running next job in queue for connection {} @{}", &connection, connection->socket);
|
||||
auto request = connection->request_queue.take_first();
|
||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
||||
connection->timer.start();
|
||||
connection->current_url = url;
|
||||
}
|
||||
connection->timer.start();
|
||||
connection->current_url = url;
|
||||
request(connection->socket);
|
||||
}
|
||||
};
|
||||
|
@ -79,7 +76,6 @@ void request_did_finish(URL const& url, Core::Socket const* socket)
|
|||
dbgln("Unknown socket {} finished for URL {}", *socket, url);
|
||||
}
|
||||
|
||||
#if REQUEST_SERVER_DEBUG
|
||||
void dump_jobs()
|
||||
{
|
||||
dbgln("=========== TLS Connection Cache ==========");
|
||||
|
@ -105,6 +101,5 @@ void dump_jobs()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -36,10 +36,8 @@ struct Connection {
|
|||
QueueType request_queue;
|
||||
NonnullRefPtr<Core::Timer> removal_timer;
|
||||
bool has_started { false };
|
||||
#if REQUEST_SERVER_DEBUG
|
||||
URL current_url {};
|
||||
Core::ElapsedTimer timer {};
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ConnectionKey {
|
||||
|
@ -110,10 +108,8 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job)
|
|||
dbgln("Immediately start request for url {} in {} - {}", url, &connection, connection.socket);
|
||||
connection.has_started = true;
|
||||
connection.removal_timer->stop();
|
||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
||||
connection.timer.start();
|
||||
connection.current_url = url;
|
||||
}
|
||||
connection.timer.start();
|
||||
connection.current_url = url;
|
||||
start_job(*connection.socket);
|
||||
} else {
|
||||
dbgln("Enqueue request for URL {} in {} - {}", url, &connection, connection.socket);
|
||||
|
|
|
@ -17,20 +17,13 @@
|
|||
|
||||
int main(int, char**)
|
||||
{
|
||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
||||
if (pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); });
|
||||
} else {
|
||||
if (pledge("stdio inet accept unix rpath sendfd recvfd", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
if (pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); });
|
||||
|
||||
// Ensure the certificates are read out here.
|
||||
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||
|
||||
|
|
Loading…
Reference in a new issue