|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
#include <ev/ev_win32.hpp>
|
|
|
|
|
|
|
|
|
|
// a single event queue for the TUN interface
|
|
|
|
|
HANDLE tun_event_queue = INVALID_HANDLE_VALUE;
|
|
|
|
|
static HANDLE tun_event_queue = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
|
|
|
|
// we hand the kernel our thread handles to process completion events
|
|
|
|
|
HANDLE* kThreadPool;
|
|
|
|
|
static HANDLE* kThreadPool;
|
|
|
|
|
|
|
|
|
|
// list of TUN listeners (useful for exits or other nodes with multiple TUNs)
|
|
|
|
|
std::list< win32_tun_io* > tun_listeners;
|
|
|
|
@ -181,6 +181,8 @@ tun_ev_loop(void* unused)
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
exit_tun_loop()
|
|
|
|
|
{
|
|
|
|
|
if(kThreadPool)
|
|
|
|
|
{
|
|
|
|
|
// if we get all-ones in the queue, thread exits, and we clean up
|
|
|
|
|
PostQueuedCompletionStatus(tun_event_queue, 0, ~0, nullptr);
|
|
|
|
@ -205,6 +207,7 @@ exit_tun_loop()
|
|
|
|
|
}
|
|
|
|
|
CloseHandle(tun_event_queue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
|
{
|
|
|
|
@ -630,5 +633,8 @@ llarp_win32_loop::udp_close(llarp_udp_io* l)
|
|
|
|
|
void
|
|
|
|
|
llarp_win32_loop::stop()
|
|
|
|
|
{
|
|
|
|
|
// do nothing
|
|
|
|
|
if(upollfd)
|
|
|
|
|
upoll_destroy(upollfd);
|
|
|
|
|
upollfd = nullptr;
|
|
|
|
|
llarp::LogDebug("destroy upoll");
|
|
|
|
|
}
|