1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:07:45 +00:00

LookupServer: Don't create Core::Object on the stack

This commit is contained in:
Andreas Kling 2021-01-30 11:42:35 +01:00
parent 553361d83f
commit 5cbc9d5724
2 changed files with 3 additions and 4 deletions

View file

@ -28,18 +28,17 @@
#include "DNSRequest.h" #include "DNSRequest.h"
#include "DNSResponse.h" #include "DNSResponse.h"
#include <AK/HashMap.h>
#include <LibCore/Object.h> #include <LibCore/Object.h>
class DNSAnswer; class DNSAnswer;
class LookupServer final : public Core::Object { class LookupServer final : public Core::Object {
C_OBJECT(LookupServer) C_OBJECT(LookupServer);
public: public:
private:
LookupServer(); LookupServer();
private:
void load_etc_hosts(); void load_etc_hosts();
void service_client(RefPtr<Core::LocalSocket>); void service_client(RefPtr<Core::LocalSocket>);
Vector<String> lookup(const String& hostname, const String& nameserver, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); Vector<String> lookup(const String& hostname, const String& nameserver, bool& did_get_response, unsigned short record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes);

View file

@ -37,7 +37,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
} }
Core::EventLoop event_loop; Core::EventLoop event_loop;
LookupServer server; auto server = LookupServer::construct();
if (pledge("stdio accept inet", nullptr) < 0) { if (pledge("stdio accept inet", nullptr) < 0) {
perror("pledge"); perror("pledge");