mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
49b9ad7197
* partial tun code refactor * take out the trash * move vpn platform code into llarp/vpn/platform.cpp * fix hive build * fix win32 * fix memory leak on win32 * reduce cpu use * make macos compile * win32 patches: * use wepoll for zmq * use all cores on windows iocp read loop * fix zmq patch for windows * clean up cmake for win32 * add uninstall before reinstall option to win32 installer * more ipv6 stuff * make it compile * fix up route poker * remove an unneeded code block in macos wtf * always use call to system * fix route poker behavior on macos * disable ipv6 on windows for now * cpu perf improvement: * colease calls to Router::PumpLL to 1 per event loop wakeup * set up THEN add addresses * emulate proactor event loop on win32 * remove excessively verbose error message * fix issue #1499 * exclude uv_poll from win32 so that it can start up * update logtag to include directory * create minidump on windows if there was a crash * make windows happy * use dmp suffix on minidump files * typo fix * address feedback from jason * use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR * quote $@ in apply-patches in case path has spaces in it * address feedback from tom * remove llarp/ev/pipe * add comments for clairification * make event loop queue size constant named
53 lines
910 B
C++
53 lines
910 B
C++
#ifndef LLARP_LOGIC_HPP
|
|
#define LLARP_LOGIC_HPP
|
|
|
|
#include <ev/ev.hpp>
|
|
#include <util/mem.h>
|
|
|
|
namespace llarp
|
|
{
|
|
class Logic
|
|
{
|
|
public:
|
|
/// stop all operation and wait for that to die
|
|
void
|
|
stop();
|
|
|
|
void
|
|
Call(std::function<void(void)> func);
|
|
|
|
uint32_t
|
|
call_later(llarp_time_t later, std::function<void(void)> func);
|
|
|
|
void
|
|
cancel_call(uint32_t id);
|
|
|
|
void
|
|
remove_call(uint32_t id);
|
|
|
|
void
|
|
SetQueuer(std::function<void(std::function<void(void)>)> q);
|
|
|
|
void
|
|
set_event_loop(EventLoop* loop);
|
|
|
|
void
|
|
clear_event_loop();
|
|
|
|
private:
|
|
EventLoop* m_Loop = nullptr;
|
|
std::function<void(std::function<void(void)>)> m_Queue;
|
|
};
|
|
} // namespace llarp
|
|
|
|
/// this used to be a macro
|
|
template <typename Logic_ptr, typename Func_t>
|
|
static bool
|
|
LogicCall(const Logic_ptr& logic, Func_t func)
|
|
{
|
|
logic->Call(std::move(func));
|
|
return true;
|
|
}
|
|
|
|
#endif
|