2019-10-04 18:10:58 +00:00
|
|
|
#include <ev/vpnio.hpp>
|
|
|
|
#include <llarp.hpp>
|
|
|
|
#include <router/abstractrouter.hpp>
|
|
|
|
#include <util/thread/logic.hpp>
|
|
|
|
|
|
|
|
void
|
|
|
|
llarp_vpn_io_impl::AsyncClose()
|
|
|
|
{
|
|
|
|
reader.queue.disable();
|
|
|
|
writer.queue.disable();
|
|
|
|
|
2020-06-29 19:55:59 +00:00
|
|
|
// TODO: call asynchronously
|
2020-06-29 20:39:31 +00:00
|
|
|
if (ctx)
|
|
|
|
ctx->CallSafe([this]() { Expunge(); });
|
|
|
|
else
|
|
|
|
Expunge();
|
2019-10-04 18:10:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
llarp_vpn_io_impl::Expunge()
|
|
|
|
{
|
|
|
|
parent->impl = nullptr;
|
2020-04-07 18:38:56 +00:00
|
|
|
if (parent->closed)
|
2019-10-04 18:10:58 +00:00
|
|
|
parent->closed(parent);
|
|
|
|
delete this;
|
2020-06-29 19:55:59 +00:00
|
|
|
}
|