Windows: full module parity and runtime-qualified test suite
- Net/IO: Winsock sockets (UdpSocket, TlsClientStream, WebSocketClient), HttpServer port with a loopback wake socket replacing eventfd, and the select-based IO backend built on Windows (ws2_32). - Net: implement StaticFileResolver::open_safe and OpenedStaticFile on Windows (reparse-point rejection plus canonical containment check on the opened handle) and widen native handles to intptr_t. - Plugin: hot reload works on Windows by loading a fresh copy while the old DLL stays mapped; enable the reload, discovery and FSM service reload tests and retire the plugin file by rename instead of replacement. - Update: activation pointer as a directory junction on Windows. - Stacktrace: portable path comparison for wide native strings. - Docs/targets: every module allowlisted on Windows; record the Wine run (2000 tests, 1977 passed, 23 skipped, 0 failed). - CMake: add -Wa,-mbig-obj for GNU MinGW targets (COFF section limit). - Async: fix the FuturePool stopped-after-close test to wait for the executor to release its admission slot instead of racing it. Windows and Linux suites both pass: Windows 2000/1977/23 skips/0 failed, Linux 2027/2023/4 skips/0 failed.
This commit is contained in:
1 parent
1b1947340f
commit
b3c959b920
32 files changed
+1836
-401
No files matched your search
@@ -108,6 +108,14 @@ namespace Void::Net
|
||||
std::vector<Route> routes_;
|
||||
};
|
||||
|
||||
/// Native file handle: a POSIX file descriptor or, on Windows, a
|
||||
/// cast `HANDLE`. `-1` means closed on both platforms.
|
||||
#if defined(_WIN32)
|
||||
using NativeFileHandle = std::intptr_t;
|
||||
#else
|
||||
using NativeFileHandle = int;
|
||||
#endif
|
||||
|
||||
struct StaticFile {
|
||||
std::filesystem::path path;
|
||||
std::string_view content_type;
|
||||
@@ -115,13 +123,16 @@ namespace Void::Net
|
||||
};
|
||||
|
||||
/// Move-only RAII handle for a regular file opened beneath a pinned root
|
||||
/// directory descriptor using `openat(..., O_NOFOLLOW)` (zero TOCTOU).
|
||||
/// directory handle and verified to stay inside it (zero TOCTOU on POSIX
|
||||
/// via `openat(..., O_NOFOLLOW)`; on Windows via reparse-point rejection
|
||||
/// plus a final canonical-path containment check on the opened handle).
|
||||
class OpenedStaticFile final
|
||||
{
|
||||
public:
|
||||
|
||||
OpenedStaticFile() noexcept = default;
|
||||
OpenedStaticFile(int fd, std::filesystem::path relative_path,
|
||||
OpenedStaticFile(NativeFileHandle fd,
|
||||
std::filesystem::path relative_path,
|
||||
std::string_view content_type,
|
||||
std::uint64_t size) noexcept;
|
||||
~OpenedStaticFile() noexcept;
|
||||
@@ -132,7 +143,10 @@ namespace Void::Net
|
||||
OpenedStaticFile& operator=(const OpenedStaticFile&) = delete;
|
||||
|
||||
[[nodiscard]] bool valid() const noexcept { return fd_ >= 0; }
|
||||
[[nodiscard]] int native_handle() const noexcept { return fd_; }
|
||||
[[nodiscard]] NativeFileHandle native_handle() const noexcept
|
||||
{
|
||||
return fd_;
|
||||
}
|
||||
[[nodiscard]] const std::filesystem::path&
|
||||
relative_path() const noexcept
|
||||
{
|
||||
@@ -151,7 +165,7 @@ namespace Void::Net
|
||||
|
||||
private:
|
||||
|
||||
int fd_{-1};
|
||||
NativeFileHandle fd_{-1};
|
||||
std::filesystem::path relative_path_{};
|
||||
std::string_view content_type_{};
|
||||
std::uint64_t size_{0};
|
||||
@@ -188,8 +202,8 @@ namespace Void::Net
|
||||
private:
|
||||
|
||||
struct DirHandle {
|
||||
int fd{-1};
|
||||
explicit DirHandle(int d) noexcept : fd(d) {}
|
||||
NativeFileHandle fd{-1};
|
||||
explicit DirHandle(NativeFileHandle d) noexcept : fd(d) {}
|
||||
~DirHandle() noexcept;
|
||||
DirHandle(const DirHandle&) = delete;
|
||||
DirHandle& operator=(const DirHandle&) = delete;
|
||||
|
||||
@@ -13,6 +13,14 @@ namespace Void::Net
|
||||
class UdpSocket final
|
||||
{
|
||||
public:
|
||||
// Native socket handles are int on POSIX and SOCKET (an unsigned
|
||||
// pointer-sized value) on Windows.
|
||||
#ifdef _WIN32
|
||||
using NativeHandle = std::intptr_t;
|
||||
#else
|
||||
using NativeHandle = int;
|
||||
#endif
|
||||
|
||||
UdpSocket() noexcept = default;
|
||||
~UdpSocket();
|
||||
UdpSocket(UdpSocket&& other) noexcept;
|
||||
@@ -23,7 +31,10 @@ namespace Void::Net
|
||||
[[nodiscard]] static Void::Result::Result<UdpSocket, Void::Result::Error>
|
||||
connect(std::string_view host, std::uint16_t port);
|
||||
[[nodiscard]] bool valid() const noexcept { return handle_ >= 0; }
|
||||
[[nodiscard]] int native_handle() const noexcept { return handle_; }
|
||||
[[nodiscard]] NativeHandle native_handle() const noexcept
|
||||
{
|
||||
return handle_;
|
||||
}
|
||||
void close() noexcept;
|
||||
void shutdown() noexcept;
|
||||
[[nodiscard]] Void::Result::Result<bool, Void::Result::Error>
|
||||
@@ -34,7 +45,7 @@ namespace Void::Net
|
||||
receive(std::span<std::uint8_t> destination);
|
||||
|
||||
private:
|
||||
explicit UdpSocket(int handle) noexcept : handle_(handle) {}
|
||||
int handle_{-1};
|
||||
explicit UdpSocket(NativeHandle handle) noexcept : handle_(handle) {}
|
||||
NativeHandle handle_{-1};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user