disable lokinet-bootstrap on windows builds

This commit is contained in:
Jeff Becker 2022-08-29 10:24:04 -04:00
parent 871c3e3281
commit 7f27760c97
No known key found for this signature in database
GPG Key ID: 025C02EE3A092F2D
10 changed files with 24 additions and 20 deletions

View File

@ -21,6 +21,7 @@ cmake \
-DBUILD_TESTING=OFF \ -DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \ -DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \ -DWITH_TESTS=OFF \
-DWITH_BOOTSTRAP=OFF \
-DNATIVE_BUILD=OFF \ -DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \ -DSTATIC_LINK=ON \
-DWITH_SYSTEMD=OFF \ -DWITH_SYSTEMD=OFF \

View File

@ -55,7 +55,6 @@ endif()
foreach(exe ${exetargets}) foreach(exe ${exetargets})
if(WIN32) if(WIN32)
target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/${exe}.rc) target_sources(${exe} PRIVATE ${CMAKE_BINARY_DIR}/${exe}.rc)
target_compile_options(${exe} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00) target_link_libraries(${exe} PRIVATE -static-libstdc++ -static-libgcc --static -Wl,--pic-executable,-e,mainCRTStartup,--subsystem,console:5.00)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
target_link_directories(${exe} PRIVATE /usr/local/lib) target_link_directories(${exe} PRIVATE /usr/local/lib)

View File

@ -680,7 +680,7 @@ win32_daemon_entry(DWORD argc, LPTSTR* argv)
ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR, 3000); ReportSvcStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
// SCM clobbers startup args, regenerate them here // SCM clobbers startup args, regenerate them here
argc = 2; argc = 2;
argv[1] = strdup("c:/programdata/lokinet/lokinet.ini"); argv[1] = strdup("c:\\programdata\\lokinet\\lokinet.ini");
argv[2] = nullptr; argv[2] = nullptr;
lokinet_main(argc, argv); lokinet_main(argc, argv);
} }

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "platform.hpp"
#include <llarp/util/fs.hpp> #include <llarp/util/fs.hpp>
@ -21,20 +22,22 @@ namespace llarp
inline fs::path inline fs::path
GetDefaultDataDir() GetDefaultDataDir()
{ {
#ifdef _WIN32 if constexpr (not platform::is_windows)
return "C:/programdata/lokinet";
#else
fs::path datadir{"/var/lib/lokinet"};
if (auto uid = ::geteuid())
{ {
if (auto* pw = getpwuid(uid)) fs::path datadir{"/var/lib/lokinet"};
#ifndef _WIN32
if (auto uid = geteuid())
{ {
datadir = fs::path{pw->pw_dir} / ".lokinet"; if (auto* pw = getpwuid(uid))
{
datadir = fs::path{pw->pw_dir} / ".lokinet";
}
} }
}
return datadir;
#endif #endif
return datadir;
}
else
return "C:\\ProgramData\\Lokinet";
} }
inline fs::path inline fs::path

View File

@ -1 +0,0 @@

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "platform.hpp" #include "platform.hpp"
#include "null_platform.hpp"
#include <llarp/constants/platform.hpp> #include <llarp/constants/platform.hpp>
#include <type_traits> #include <type_traits>

View File

@ -1 +0,0 @@

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "platform.hpp" #include "platform.hpp"
#include "null_platform.hpp"
#include <llarp/constants/platform.hpp> #include <llarp/constants/platform.hpp>
#include <type_traits> #include <type_traits>

View File

@ -223,7 +223,6 @@ namespace llarp
return nullptr; return nullptr;
} }
protected:
// Triggers an event loop wakeup; use when something has been done that requires the event loop // Triggers an event loop wakeup; use when something has been done that requires the event loop
// to wake up (e.g. adding to queues). This is called implicitly by call() and call_soon(). // to wake up (e.g. adding to queues). This is called implicitly by call() and call_soon().
// Idempotent and thread-safe. // Idempotent and thread-safe.

View File

@ -66,6 +66,8 @@ namespace llarp::win32
HANDLE m_Handle; HANDLE m_Handle;
std::thread m_Runner; std::thread m_Runner;
thread::Queue<WD_Packet> m_RecvQueue; thread::Queue<WD_Packet> m_RecvQueue;
// dns packet queue size
static constexpr size_t recv_queue_size = 64;
public: public:
WinDivert_IO( WinDivert_IO(
@ -132,7 +134,7 @@ namespace llarp::win32
virtual net::IPPacket virtual net::IPPacket
ReadNextPacket() override ReadNextPacket() override
{ {
auto w_pkt = recv_packet(); auto w_pkt = m_RecvQueue.tryPopFront();
if (not w_pkt) if (not w_pkt)
return net::IPPacket{}; return net::IPPacket{};
net::IPPacket pkt{std::move(w_pkt->pkt)}; net::IPPacket pkt{std::move(w_pkt->pkt)};
@ -150,17 +152,21 @@ namespace llarp::win32
throw std::runtime_error{"windivert thread is already running"}; throw std::runtime_error{"windivert thread is already running"};
auto read_loop = [this]() { auto read_loop = [this]() {
log::debug(cat, "windivert read loop start"); log::info(cat, "windivert read loop start");
while (true) while (true)
{ {
// in the read loop, read packets until they stop coming in // in the read loop, read packets until they stop coming in
// each packet is sent off // each packet is sent off
if (auto maybe_pkt = recv_packet()) if (auto maybe_pkt = recv_packet())
{
m_RecvQueue.pushBack(std::move(*maybe_pkt)); m_RecvQueue.pushBack(std::move(*maybe_pkt));
// wake up event loop
m_Wake();
}
else // leave loop on read fail else // leave loop on read fail
break; break;
} }
log::debug(cat, "windivert read loop end"); log::info(cat, "windivert read loop end");
}; };
m_Runner = std::thread{std::move(read_loop)}; m_Runner = std::thread{std::move(read_loop)};