1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 12:15:07 +00:00
serenity/Kernel/Net/LoopbackAdapter.cpp
Andreas Kling c02c9880b6 AK: Add Eternal<T> and use it in various places.
This is useful for static locals that never need to be destroyed:

Thing& Thing::the()
{
    static Eternal<Thing> the;
    return the;
}

The object will be allocated in data segment memory and will never have
its destructor invoked.
2019-04-03 16:52:25 +02:00

23 lines
453 B
C++

#include <Kernel/Net/LoopbackAdapter.h>
#include <AK/Eternal.h>
LoopbackAdapter& LoopbackAdapter::the()
{
static Eternal<LoopbackAdapter> the;
return the;
}
LoopbackAdapter::LoopbackAdapter()
{
set_ipv4_address({ 127, 0, 0, 1 });
}
LoopbackAdapter::~LoopbackAdapter()
{
}
void LoopbackAdapter::send_raw(const byte* data, int size)
{
dbgprintf("LoopbackAdapter: Sending %d byte(s) to myself.\n", size);
did_receive(data, size);
}