mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +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
5 changed files with 10 additions and 31 deletions
|
@ -338,10 +338,6 @@
|
||||||
#cmakedefine01 REGEX_DEBUG
|
#cmakedefine01 REGEX_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef REQUEST_SERVER_DEBUG
|
|
||||||
#cmakedefine01 REQUEST_SERVER_DEBUG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef RESIZE_DEBUG
|
#ifndef RESIZE_DEBUG
|
||||||
#cmakedefine01 RESIZE_DEBUG
|
#cmakedefine01 RESIZE_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -141,7 +141,6 @@ set(PTHREAD_DEBUG ON)
|
||||||
set(PTMX_DEBUG ON)
|
set(PTMX_DEBUG ON)
|
||||||
set(REACHABLE_DEBUG ON)
|
set(REACHABLE_DEBUG ON)
|
||||||
set(REGEX_DEBUG ON)
|
set(REGEX_DEBUG ON)
|
||||||
set(REQUEST_SERVER_DEBUG ON)
|
|
||||||
set(RESIZE_DEBUG ON)
|
set(RESIZE_DEBUG ON)
|
||||||
set(RESOURCE_DEBUG ON)
|
set(RESOURCE_DEBUG ON)
|
||||||
set(ROUTING_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;
|
auto& connection = *connection_it;
|
||||||
if (connection->request_queue.is_empty()) {
|
if (connection->request_queue.is_empty()) {
|
||||||
connection->has_started = false;
|
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 {
|
connection->removal_timer->on_timeout = [ptr = connection.ptr(), &cache_entry = *it->value, key = it->key, &cache]() mutable {
|
||||||
Core::deferred_invoke([&, key = move(key), ptr] {
|
Core::deferred_invoke([&, key = move(key), ptr] {
|
||||||
dbgln("Removing no-longer-used connection {} (socket {})", ptr, ptr->socket);
|
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);
|
dbgln("Running next job in queue for connection {} @{}", &connection, connection->socket);
|
||||||
auto request = connection->request_queue.take_first();
|
auto request = connection->request_queue.take_first();
|
||||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
connection->timer.start();
|
||||||
connection->timer.start();
|
connection->current_url = url;
|
||||||
connection->current_url = url;
|
|
||||||
}
|
|
||||||
request(connection->socket);
|
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);
|
dbgln("Unknown socket {} finished for URL {}", *socket, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if REQUEST_SERVER_DEBUG
|
|
||||||
void dump_jobs()
|
void dump_jobs()
|
||||||
{
|
{
|
||||||
dbgln("=========== TLS Connection Cache ==========");
|
dbgln("=========== TLS Connection Cache ==========");
|
||||||
|
@ -105,6 +101,5 @@ void dump_jobs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,8 @@ struct Connection {
|
||||||
QueueType request_queue;
|
QueueType request_queue;
|
||||||
NonnullRefPtr<Core::Timer> removal_timer;
|
NonnullRefPtr<Core::Timer> removal_timer;
|
||||||
bool has_started { false };
|
bool has_started { false };
|
||||||
#if REQUEST_SERVER_DEBUG
|
|
||||||
URL current_url {};
|
URL current_url {};
|
||||||
Core::ElapsedTimer timer {};
|
Core::ElapsedTimer timer {};
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConnectionKey {
|
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);
|
dbgln("Immediately start request for url {} in {} - {}", url, &connection, connection.socket);
|
||||||
connection.has_started = true;
|
connection.has_started = true;
|
||||||
connection.removal_timer->stop();
|
connection.removal_timer->stop();
|
||||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
connection.timer.start();
|
||||||
connection.timer.start();
|
connection.current_url = url;
|
||||||
connection.current_url = url;
|
|
||||||
}
|
|
||||||
start_job(*connection.socket);
|
start_job(*connection.socket);
|
||||||
} else {
|
} else {
|
||||||
dbgln("Enqueue request for URL {} in {} - {}", url, &connection, connection.socket);
|
dbgln("Enqueue request for URL {} in {} - {}", url, &connection, connection.socket);
|
||||||
|
|
|
@ -17,20 +17,13 @@
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
if constexpr (REQUEST_SERVER_DEBUG) {
|
if (pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr) < 0) {
|
||||||
if (pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr) < 0) {
|
perror("pledge");
|
||||||
perror("pledge");
|
return 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); });
|
||||||
|
|
||||||
// Ensure the certificates are read out here.
|
// Ensure the certificates are read out here.
|
||||||
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue