mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:27:36 +00:00
LookupServer: Watch /etc/hosts for changes during runtime
This adds a FileWatcher to the LookupServer which watches '/etc/hosts' for changes during runtime and reloads its contents. If the file is deleted, m_etc_hosts will be cleared. Since we now need to access '/etc/hosts' later during runtime, it needs to be unveiled with read permissions.
This commit is contained in:
parent
7b39db3bf4
commit
4efccbd030
3 changed files with 31 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "DNSPacket.h"
|
||||
#include "DNSServer.h"
|
||||
#include "MulticastDNS.h"
|
||||
#include <LibCore/FileWatcher.h>
|
||||
#include <LibCore/Object.h>
|
||||
|
||||
namespace LookupServer {
|
||||
|
@ -35,6 +36,7 @@ private:
|
|||
RefPtr<DNSServer> m_dns_server;
|
||||
RefPtr<MulticastDNS> m_mdns;
|
||||
Vector<String> m_nameservers;
|
||||
RefPtr<Core::FileWatcher> m_file_watcher;
|
||||
HashMap<DNSName, Vector<DNSAnswer>, DNSName::Traits> m_etc_hosts;
|
||||
HashMap<DNSName, Vector<DNSAnswer>, DNSName::Traits> m_lookup_cache;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue