mirror of
https://github.com/Simplxss/SignerServer.git
synced 2024-11-21 00:37:53 +08:00
fix linux
This commit is contained in:
parent
1a682ff12d
commit
260223e70b
82
src/main.cpp
82
src/main.cpp
@ -2,48 +2,52 @@
|
|||||||
|
|
||||||
Server *server = nullptr;
|
Server *server = nullptr;
|
||||||
|
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::string ip = "0.0.0.0";
|
||||||
|
int port = 8080;
|
||||||
|
printf("Start Init server\n");
|
||||||
|
server = new Server();
|
||||||
|
server->Init();
|
||||||
|
|
||||||
|
printf("Start Init sign\n");
|
||||||
|
std::thread([=] { // Cannot use '&' capture!!!!! will cause crash
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Sign::Init())
|
||||||
|
{
|
||||||
|
if (!server->Run(ip, port))
|
||||||
|
printf("Server run failed\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
printf("Init failed: %s\n", e.what());
|
||||||
|
}
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
printf("Init failed: %s\n", e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN_PLATFORM_)
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
switch (fdwReason)
|
switch (fdwReason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
{
|
init();
|
||||||
try
|
|
||||||
{
|
|
||||||
std::string ip = "0.0.0.0";
|
|
||||||
int port = 8080;
|
|
||||||
printf("Start Init server\n");
|
|
||||||
server = new Server();
|
|
||||||
server->Init();
|
|
||||||
|
|
||||||
printf("Start Init sign\n");
|
|
||||||
std::thread([=] { // Cannot use & capture!!!!! will cause crash
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Sign::Init())
|
|
||||||
{
|
|
||||||
if (!server->Run(ip, port))
|
|
||||||
printf("Server run failed\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (const std::exception &e)
|
|
||||||
{
|
|
||||||
printf("Init failed: %s\n", e.what());
|
|
||||||
}
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
}
|
|
||||||
catch (const std::exception &e)
|
|
||||||
{
|
|
||||||
printf("Init failed: %s\n", e.what());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
@ -58,3 +62,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#elif defined(_MAC_PLATFORM_) || defined(_LINUX_PLATFORM_)
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
#endif
|
@ -50,12 +50,13 @@ std::map<std::string, uint64_t> addrMap = {
|
|||||||
{"6.9.20-17153", 0x1c73dd0}};
|
{"6.9.20-17153", 0x1c73dd0}};
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_LINUX_PLATFORM_)
|
#elif defined(_LINUX_PLATFORM_)
|
||||||
#define CURRENT_VERSION "3.2.7-23361"
|
#define CURRENT_VERSION "3.2.9-24815"
|
||||||
#if defined(_X64_ARCH_)
|
#if defined(_X64_ARCH_)
|
||||||
std::map<std::string, uint64_t> addrMap = {
|
std::map<std::string, uint64_t> addrMap = {
|
||||||
{"3.1.2-12912", 0x33C38E0},
|
{"3.1.2-12912", 0x33C38E0},
|
||||||
{"3.1.2-13107", 0x33C3920},
|
{"3.1.2-13107", 0x33C3920},
|
||||||
{"3.2.7-23361", 0x4C93C57}};
|
{"3.2.7-23361", 0x4C93C57},
|
||||||
|
{"3.2.9-24815", 0x4E5D3B7}};
|
||||||
#elif defined(_ARM64_ARCH_)
|
#elif defined(_ARM64_ARCH_)
|
||||||
std::map<std::string, uint64_t> addrMap = {
|
std::map<std::string, uint64_t> addrMap = {
|
||||||
{"3.2.7-23361", 0x351EC98}};
|
{"3.2.7-23361", 0x351EC98}};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user