[FEAT]: VCPKG

This commit is contained in:
2025-12-21 07:49:28 +05:30
parent 74678d4c4f
commit a956f7b770
13 changed files with 226 additions and 110 deletions

View File

@ -146,8 +146,8 @@ namespace IACore
namespace IACore
{
CONSTEXPR UINT32 XXH_PRIME32_1 = 0x9E3779B1U;
CONSTEXPR UINT32 XXH_PRIME32_2 = 0x85EBCA6BU;
CONSTEXPR UINT32 XXH_PRIME32_3 = 0xC2B2AE35U;
CONSTEXPR UINT32 XXH_PRIME32_2 = 0x85EBCA77U;
CONSTEXPR UINT32 XXH_PRIME32_3 = 0xC2B2AE3DU;
CONSTEXPR UINT32 XXH_PRIME32_4 = 0x27D4EB2FU;
CONSTEXPR UINT32 XXH_PRIME32_5 = 0x165667B1U;
@ -159,12 +159,12 @@ namespace IACore
return seed;
}
UINT32 DataOps::Hash_xxHash(IN CONST String &string)
UINT32 DataOps::Hash_xxHash(IN CONST String &string, IN UINT32 seed)
{
return Hash_xxHash(Span<CONST UINT8>(reinterpret_cast<PCUINT8>(string.data()), string.size()));
return Hash_xxHash(Span<CONST UINT8>(reinterpret_cast<PCUINT8>(string.data()), string.length()), seed);
}
UINT32 DataOps::Hash_xxHash(IN Span<CONST UINT8> data)
UINT32 DataOps::Hash_xxHash(IN Span<CONST UINT8> data, IN UINT32 seed)
{
CONST UINT8 *p = data.data();
CONST UINT8 *CONST bEnd = p + data.size();
@ -174,10 +174,10 @@ namespace IACore
{
const UINT8 *const limit = bEnd - 16;
UINT32 v1 = XXH_PRIME32_1 + XXH_PRIME32_2;
UINT32 v2 = XXH_PRIME32_2;
UINT32 v3 = 0;
UINT32 v4 = -XXH_PRIME32_1;
UINT32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2;
UINT32 v2 = seed + XXH_PRIME32_2;
UINT32 v3 = seed + 0;
UINT32 v4 = seed - XXH_PRIME32_1;
do
{
@ -194,13 +194,14 @@ namespace IACore
h32 = std::rotl(v1, 1) + std::rotl(v2, 7) + std::rotl(v3, 12) + std::rotl(v4, 18);
}
else
h32 = XXH_PRIME32_5;
h32 = seed + XXH_PRIME32_5;
h32 += (UINT32) data.size();
while (p + 4 <= bEnd)
{
h32 += ReadUnaligned<UINT32>(p) * XXH_PRIME32_3;
const auto t = ReadUnaligned<UINT32>(p) * XXH_PRIME32_3;
h32 += t;
h32 = std::rotl(h32, 17) * XXH_PRIME32_4;
p += 4;
}

View File

@ -228,6 +228,7 @@ namespace IACore
case EHeaderType::WARNING:
return "Warning";
}
return "<Unknown>";
}
BOOL HttpClient::IsSuccessResponseCode(IN EResponseCode code)

View File

@ -191,7 +191,7 @@ namespace IACore
{
for (auto &session : m_activeSessions)
{
ProcessOps::TerminateProcess(session->ProcessHandle);
ProcessOps::TerminateProcess(session->NodeProcess);
FileOps::UnmapFile(session->MappedPtr);
FileOps::UnlinkSharedMemory(session->SharedMemName);
SocketOps::Close(session->DataSocket);
@ -200,7 +200,7 @@ namespace IACore
for (auto &session : m_pendingSessions)
{
ProcessOps::TerminateProcess(session->ProcessHandle);
ProcessOps::TerminateProcess(session->NodeProcess);
FileOps::UnmapFile(session->MappedPtr);
FileOps::UnlinkSharedMemory(session->SharedMemName);
SocketOps::Close(session->ListenerSocket);
@ -221,7 +221,7 @@ namespace IACore
if (now - session->CreationTime > std::chrono::seconds(5))
{
ProcessOps::TerminateProcess(session->ProcessHandle);
ProcessOps::TerminateProcess(session->NodeProcess);
FileOps::UnmapFile(session->MappedPtr);
FileOps::UnlinkSharedMemory(session->SharedMemName);
@ -249,7 +249,7 @@ namespace IACore
SocketOps::Close(session->ListenerSocket);
session->ListenerSocket = INVALID_SOCKET;
const auto sessionID = session->ProcessHandle->ID.load();
const auto sessionID = session->NodeProcess->ID.load();
const auto sessionPtr = session.get();
m_activeSessions.push_back(std::move(session));
m_pendingSessions.erase(m_pendingSessions.begin() + i);
@ -261,7 +261,7 @@ namespace IACore
{
auto &node = m_activeSessions[i];
auto nodeID = node->ProcessHandle->ID.load();
auto nodeID = node->NodeProcess->ID.load();
RingBufferView::PacketHeader header;
@ -275,7 +275,7 @@ namespace IACore
OnSignal(nodeID, signal);
else if (res == 0 || (res < 0 && !SocketOps::IsWouldBlock()))
{
ProcessOps::TerminateProcess(node->ProcessHandle);
ProcessOps::TerminateProcess(node->NodeProcess);
FileOps::UnmapFile(node->MappedPtr);
FileOps::UnlinkSharedMemory(node->SharedMemName);
@ -355,7 +355,7 @@ namespace IACore
String args = std::format("\"{}\"", desc.Serialize());
session->ProcessHandle = ProcessOps::SpawnProcessAsync(
session->NodeProcess = ProcessOps::SpawnProcessAsync(
FileOps::NormalizeExecutablePath(executablePath).string(), args,
[sid](IN StringView line) {
UNUSED(sid);
@ -379,10 +379,10 @@ namespace IACore
// Give some time for child node to stablize
std::this_thread::sleep_for(std::chrono::seconds(1));
if (!session->ProcessHandle->IsActive())
if (!session->NodeProcess->IsActive())
return MakeUnexpected(std::format("Failed to spawn the child process \"{}\"", executablePath.string()));
auto processID = session->ProcessHandle->ID.load();
auto processID = session->NodeProcess->ID.load();
session->CreationTime = SteadyClock::now();
m_pendingSessions.push_back(std::move(session));
@ -398,7 +398,7 @@ namespace IACore
isPending = false;
for (auto it = m_pendingSessions.begin(); it != m_pendingSessions.end(); it++)
{
if (it->get()->ProcessHandle->ID.load() == nodeID)
if (it->get()->NodeProcess->ID.load() == nodeID)
{
isPending = true;
break;
@ -417,7 +417,7 @@ namespace IACore
auto &node = itNode->second;
ProcessOps::TerminateProcess(node->ProcessHandle);
ProcessOps::TerminateProcess(node->NodeProcess);
FileOps::UnmapFile(node->MappedPtr);
FileOps::UnlinkSharedMemory(node->SharedMemName);
SocketOps::Close(node->DataSocket);

View File

@ -33,8 +33,8 @@ namespace IACore
STATIC UINT32 Hash_FNV1A(IN CONST String &string);
STATIC UINT32 Hash_FNV1A(IN Span<CONST UINT8> data);
STATIC UINT32 Hash_xxHash(IN CONST String &string);
STATIC UINT32 Hash_xxHash(IN Span<CONST UINT8> data);
STATIC UINT32 Hash_xxHash(IN CONST String &string, IN UINT32 seed = 0);
STATIC UINT32 Hash_xxHash(IN Span<CONST UINT8> data, IN UINT32 seed = 0);
STATIC UINT32 CRC32(IN Span<CONST UINT8> data);

View File

@ -101,7 +101,7 @@ namespace IACore
struct NodeSession
{
SteadyTimePoint CreationTime{};
SharedPtr<ProcessHandle> ProcessHandle;
SharedPtr<ProcessHandle> NodeProcess;
Mutex SendMutex;