remove: Unused code.
This commit is contained in:
parent
c9bd9a76b1
commit
4bc4a79a4b
6
.gitignore
vendored
6
.gitignore
vendored
@ -406,6 +406,9 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# CMake
|
# CMake
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
|
cmake/
|
||||||
|
CMakeFiles/
|
||||||
|
CMakeCache.txt
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
# Mongo Explorer plugin
|
||||||
.idea/**/mongoSettings.xml
|
.idea/**/mongoSettings.xml
|
||||||
@ -442,3 +445,6 @@ fabric.properties
|
|||||||
|
|
||||||
# Debug folder
|
# Debug folder
|
||||||
test/
|
test/
|
||||||
|
|
||||||
|
# Vcpkg
|
||||||
|
vcpkg_installed/
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -5,7 +5,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug portfile(s)",
|
"name": "Debug portfile(s)",
|
||||||
"cmakeDebugType": "external",
|
"cmakeDebugType": "external",
|
||||||
"pipeName": "\\\\.\\pipe\\vcpkg_ext_portfile_dbg",
|
"pipeName": "/tmp/vcpkg_ext_portfile_dbg",
|
||||||
"preLaunchTask": "Debug vcpkg commands"
|
"preLaunchTask": "Debug vcpkg commands"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
21
.vscode/settings.json
vendored
21
.vscode/settings.json
vendored
@ -12,7 +12,24 @@
|
|||||||
"xhash": "cpp",
|
"xhash": "cpp",
|
||||||
"xstring": "cpp",
|
"xstring": "cpp",
|
||||||
"xtree": "cpp",
|
"xtree": "cpp",
|
||||||
"xutility": "cpp"
|
"xutility": "cpp",
|
||||||
|
"sstream": "cpp"
|
||||||
},
|
},
|
||||||
"editor.formatOnSave": false
|
"editor.formatOnSave": false,
|
||||||
|
"vcpkg.target.useManifest": false,
|
||||||
|
"cmake.configureArgs": [
|
||||||
|
"-DVCPKG_MANIFEST_MODE=OFF",
|
||||||
|
"-DVCPKG_APPLOCAL_DEPS=ON",
|
||||||
|
"-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON",
|
||||||
|
"-DVCPKG_TARGET_TRIPLET=x64-linux"
|
||||||
|
],
|
||||||
|
"vcpkg.general.enable": true,
|
||||||
|
"vcpkg.target.hostTriplet": "x64-linux",
|
||||||
|
"vcpkg.target.defaultTriplet": "x64-linux",
|
||||||
|
"vcpkg.target.useStaticLib": false,
|
||||||
|
"cmake.configureSettings": {
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "~/.vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||||
|
},
|
||||||
|
"vcpkg.target.installDependencies": true,
|
||||||
|
"vcpkg.target.preferSystemLibs": false
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ Install `vcpkg` according to the [latest instructions](https://vcpkg.io/en/getti
|
|||||||
|
|
||||||
Build and install the required libraries:
|
Build and install the required libraries:
|
||||||
```shell
|
```shell
|
||||||
vcpkg install cryptopp effolkronium-random libevent lzo fmt spdlog argon2 libpq
|
vcpkg install cryptopp effolkronium-random libevent lzo fmt spdlog argon2 libpq libpqxx
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Building the binaries
|
#### Building the binaries
|
||||||
|
15
TODO.md
Normal file
15
TODO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# The list
|
||||||
|
- [ ] Database initialization
|
||||||
|
- [ ] ClientManager
|
||||||
|
- [ ] ClientManagerBoot
|
||||||
|
- [ ] ClientManagerEventFlag
|
||||||
|
- [ ] ClientManagerGuild
|
||||||
|
- [ ] ClientManagerHorseName
|
||||||
|
- [ ] ClientManagerLogin
|
||||||
|
- [ ] ClientManagerPlayer
|
||||||
|
- [ ] DBManager
|
||||||
|
- [ ] GuildManager
|
||||||
|
- [ ] ItemAwardManager
|
||||||
|
- [ ] ItemIDRangeManager
|
||||||
|
- [ ] Marriage
|
||||||
|
- [ ] Monarch
|
15
common/version.h
Normal file
15
common/version.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef __INC_METIN_II_VERSION_H__
|
||||||
|
#define __INC_METIN_II_VERSION_H__
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
#define __REVISION__ "c9bd9a7"
|
||||||
|
#define __COMMIT_DATE__ "2025-06-06 20:26:23 +0100"
|
||||||
|
#define __COMMIT_TAG__ "0.4.1"
|
||||||
|
#define __OS_NAME__ "Linux-5.15.167.4-microsoft-standard-WSL2"
|
||||||
|
#define __COMPILER__ "GNU 9.5.0"
|
||||||
|
#define __CPU_TARGET__ "x86_64"
|
||||||
|
|
||||||
|
void WriteVersion();
|
||||||
|
|
||||||
|
#endif
|
@ -12,39 +12,23 @@ CLock::~CLock()
|
|||||||
void CLock::Initialize()
|
void CLock::Initialize()
|
||||||
{
|
{
|
||||||
m_bLocked = false;
|
m_bLocked = false;
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_init(&m_lock, NULL);
|
pthread_mutex_init(&m_lock, NULL);
|
||||||
#else
|
|
||||||
::InitializeCriticalSection(&m_lock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLock::Destroy()
|
void CLock::Destroy()
|
||||||
{
|
{
|
||||||
assert(!m_bLocked && "lock didn't released");
|
assert(!m_bLocked && "lock didn't released");
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_destroy(&m_lock);
|
pthread_mutex_destroy(&m_lock);
|
||||||
#else
|
|
||||||
::DeleteCriticalSection(&m_lock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLock::Trylock()
|
int CLock::Trylock()
|
||||||
{
|
{
|
||||||
#ifndef __WIN32__
|
|
||||||
return pthread_mutex_trylock(&m_lock);
|
return pthread_mutex_trylock(&m_lock);
|
||||||
#else
|
|
||||||
return ::TryEnterCriticalSection(&m_lock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLock::Lock()
|
void CLock::Lock()
|
||||||
{
|
{
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_lock(&m_lock);
|
pthread_mutex_lock(&m_lock);
|
||||||
#else
|
|
||||||
::EnterCriticalSection(&m_lock);
|
|
||||||
#endif
|
|
||||||
m_bLocked = true;
|
m_bLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +36,5 @@ void CLock::Unlock()
|
|||||||
{
|
{
|
||||||
assert(m_bLocked && "lock didn't issued");
|
assert(m_bLocked && "lock didn't issued");
|
||||||
m_bLocked = false;
|
m_bLocked = false;
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_unlock(&m_lock);
|
pthread_mutex_unlock(&m_lock);
|
||||||
#else
|
|
||||||
::LeaveCriticalSection(&m_lock);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
#ifndef __INC_LOCK_H__
|
#ifndef __INC_LOCK_H__
|
||||||
#define __INC_LOCK_H__
|
#define __INC_LOCK_H__
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
typedef CRITICAL_SECTION lock_t;
|
|
||||||
#else
|
|
||||||
typedef pthread_mutex_t lock_t;
|
typedef pthread_mutex_t lock_t;
|
||||||
#endif
|
|
||||||
|
|
||||||
class CLock
|
class CLock
|
||||||
{
|
{
|
||||||
|
@ -269,9 +269,7 @@ int Start()
|
|||||||
|
|
||||||
SPDLOG_INFO("ClientManager initialization OK");
|
SPDLOG_INFO("ClientManager initialization OK");
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
signal(SIGUSR1, emergency_sig);
|
signal(SIGUSR1, emergency_sig);
|
||||||
#endif
|
|
||||||
signal(SIGSEGV, emergency_sig);
|
signal(SIGSEGV, emergency_sig);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,7 @@
|
|||||||
|
|
||||||
#include <libthecore/include/stdafx.h>
|
#include <libthecore/include/stdafx.h>
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#else
|
|
||||||
#define isdigit iswdigit
|
|
||||||
#define isspace iswspace
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <common/length.h>
|
#include <common/length.h>
|
||||||
#include <common/tables.h>
|
#include <common/tables.h>
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "MarkManager.h"
|
#include "MarkManager.h"
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
#include <direct.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define OLD_MARK_INDEX_FILENAME "guild_mark.idx"
|
#define OLD_MARK_INDEX_FILENAME "guild_mark.idx"
|
||||||
#define OLD_MARK_DATA_FILENAME "guild_mark.tga"
|
#define OLD_MARK_DATA_FILENAME "guild_mark.tga"
|
||||||
|
|
||||||
@ -31,18 +27,10 @@ static Pixel * LoadOldGuildMarkImageFile()
|
|||||||
bool GuildMarkConvert(const std::vector<DWORD> & vecGuildID)
|
bool GuildMarkConvert(const std::vector<DWORD> & vecGuildID)
|
||||||
{
|
{
|
||||||
// 폴더 생성
|
// 폴더 생성
|
||||||
#ifndef __WIN32__
|
|
||||||
mkdir("mark", S_IRWXU);
|
mkdir("mark", S_IRWXU);
|
||||||
#else
|
|
||||||
_mkdir("mark");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 인덱스 파일이 있나?
|
// 인덱스 파일이 있나?
|
||||||
#ifndef __WIN32__
|
|
||||||
if (0 != access(OLD_MARK_INDEX_FILENAME, F_OK))
|
if (0 != access(OLD_MARK_INDEX_FILENAME, F_OK))
|
||||||
#else
|
|
||||||
if (0 != _access(OLD_MARK_INDEX_FILENAME, 0))
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// 인덱스 파일 열기
|
// 인덱스 파일 열기
|
||||||
@ -120,13 +108,8 @@ bool GuildMarkConvert(const std::vector<DWORD> & vecGuildID)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// 컨버트는 한번만 하면되므로 파일을 옮겨준다.
|
// 컨버트는 한번만 하면되므로 파일을 옮겨준다.
|
||||||
#ifndef __WIN32__
|
|
||||||
system("mv -f guild_mark.idx guild_mark.idx.removable");
|
system("mv -f guild_mark.idx guild_mark.idx.removable");
|
||||||
system("mv -f guild_mark.tga guild_mark.tga.removable");
|
system("mv -f guild_mark.tga guild_mark.tga.removable");
|
||||||
#else
|
|
||||||
system("move /Y guild_mark.idx guild_mark.idx.removable");
|
|
||||||
system("move /Y guild_mark.tga guild_mark.tga.removable");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SPDLOG_INFO("Guild Mark Converting Complete.");
|
SPDLOG_INFO("Guild Mark Converting Complete.");
|
||||||
|
|
||||||
|
@ -112,6 +112,9 @@ int CHARACTER::ChangeEmpire(BYTE empire)
|
|||||||
// 5. 제국 변경 이력을 추가한다.
|
// 5. 제국 변경 이력을 추가한다.
|
||||||
SetChangeEmpireCount();
|
SetChangeEmpireCount();
|
||||||
|
|
||||||
|
SetEmpire(empire);
|
||||||
|
UpdatePacket();
|
||||||
|
|
||||||
return 999;
|
return 999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#ifndef __WIN32__
|
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
@ -773,19 +773,6 @@ int idle()
|
|||||||
memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler));
|
memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
if (_kbhit()) {
|
|
||||||
int c = _getch();
|
|
||||||
switch (c) {
|
|
||||||
case 0x1b: // Esc
|
|
||||||
return 0; // shutdown
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1630,7 +1630,6 @@ namespace quest
|
|||||||
GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_PARTY, "LUA_ERROR: quest %s.%s %s", GetCurrentQuestName().c_str(), state_name, event_index_name.c_str() );
|
GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_PARTY, "LUA_ERROR: quest %s.%s %s", GetCurrentQuestName().c_str(), state_name, event_index_name.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
void CQuestManager::QuestError(const char* func, int line, const char* fmt, ...)
|
void CQuestManager::QuestError(const char* func, int line, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
char szMsg[4096];
|
char szMsg[4096];
|
||||||
@ -1651,28 +1650,6 @@ namespace quest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void CQuestManager::QuestError(const char* func, int line, const char* fmt, ...)
|
|
||||||
{
|
|
||||||
char szMsg[4096];
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
vsnprintf(szMsg, sizeof(szMsg), fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
_SPDLOG_ERROR(func, line, "%s", szMsg);
|
|
||||||
if (test_server)
|
|
||||||
{
|
|
||||||
LPCHARACTER ch = GetCurrentCharacterPtr();
|
|
||||||
if (ch)
|
|
||||||
{
|
|
||||||
ch->ChatPacket(CHAT_TYPE_PARTY, "error occurred on [%s:%d]", func,line);
|
|
||||||
ch->ChatPacket(CHAT_TYPE_PARTY, "%s", szMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CQuestManager::AddServerTimer(const std::string& name, DWORD arg, LPEVENT event)
|
void CQuestManager::AddServerTimer(const std::string& name, DWORD arg, LPEVENT event)
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,7 @@
|
|||||||
|
|
||||||
#include "questnpc.h"
|
#include "questnpc.h"
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
#define quest_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args)
|
#define quest_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args)
|
||||||
#else
|
|
||||||
#define quest_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ITEM;
|
class ITEM;
|
||||||
class CHARACTER;
|
class CHARACTER;
|
||||||
@ -173,12 +169,7 @@ namespace quest
|
|||||||
void ClearError() { m_bError = false; }
|
void ClearError() { m_bError = false; }
|
||||||
bool IsError() { return m_bError; }
|
bool IsError() { return m_bError; }
|
||||||
void WriteRunningStateToSyserr();
|
void WriteRunningStateToSyserr();
|
||||||
#ifndef __WIN32__
|
|
||||||
void QuestError(const char* func, int line, const char* fmt, ...);
|
void QuestError(const char* func, int line, const char* fmt, ...);
|
||||||
#else
|
|
||||||
//void QuestError(const char* fmt, ...);
|
|
||||||
void QuestError(const char* func, int line, const char* fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void RegisterNPCVnum(DWORD dwVnum);
|
void RegisterNPCVnum(DWORD dwVnum);
|
||||||
|
|
||||||
|
@ -38,12 +38,10 @@ inline int DISTANCE_APPROX(int dx, int dy)
|
|||||||
( min << 7 ) - ( min << 5 ) + ( min << 3 ) - ( min << 1 )) >> 8 );
|
( min << 7 ) - ( min << 5 ) + ( min << 3 ) - ( min << 1 )) >> 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
inline WORD MAKEWORD(BYTE a, BYTE b)
|
inline WORD MAKEWORD(BYTE a, BYTE b)
|
||||||
{
|
{
|
||||||
return static_cast<WORD>(a) | (static_cast<WORD>(b) << 8);
|
return static_cast<WORD>(a) | (static_cast<WORD>(b) << 8);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void set_global_time(time_t t);
|
extern void set_global_time(time_t t);
|
||||||
extern time_t get_global_time();
|
extern time_t get_global_time();
|
||||||
|
@ -9,11 +9,7 @@ using namespace std;
|
|||||||
|
|
||||||
double _random()
|
double _random()
|
||||||
{
|
{
|
||||||
#ifndef __WIN32__
|
|
||||||
return random() / (2147483648.0);
|
return random() / (2147483648.0);
|
||||||
#else
|
|
||||||
return rand() / (2147483648.0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPoly::my_irandom(double start, double end)
|
int CPoly::my_irandom(double start, double end)
|
||||||
|
@ -181,15 +181,9 @@ class CAsyncSQL
|
|||||||
|
|
||||||
volatile bool m_bEnd;
|
volatile bool m_bEnd;
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_t m_hThread;
|
pthread_t m_hThread;
|
||||||
pthread_mutex_t * m_mtxQuery;
|
pthread_mutex_t * m_mtxQuery;
|
||||||
pthread_mutex_t * m_mtxResult;
|
pthread_mutex_t * m_mtxResult;
|
||||||
#else
|
|
||||||
HANDLE m_hThread;
|
|
||||||
CRITICAL_SECTION* m_mtxQuery;
|
|
||||||
CRITICAL_SECTION* m_mtxResult;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CSemaphore m_sem;
|
CSemaphore m_sem;
|
||||||
|
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
#ifndef __INC_METIN_II_LIBSQL_STATEMENT_H__
|
|
||||||
#define __INC_METIN_II_LIBSQL_STATEMENT_H__
|
|
||||||
|
|
||||||
#include "CAsyncSQL.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class CStmt
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CStmt();
|
|
||||||
virtual ~CStmt();
|
|
||||||
|
|
||||||
bool Prepare(CAsyncSQL * sql, const char * c_pszQuery);
|
|
||||||
bool BindParam(enum_field_types type, void * p, int iMaxLen=0);
|
|
||||||
bool BindResult(enum_field_types type, void * p, int iMaxLen=0);
|
|
||||||
int Execute();
|
|
||||||
bool Fetch();
|
|
||||||
|
|
||||||
void Error(const char * c_pszMsg);
|
|
||||||
|
|
||||||
public:
|
|
||||||
int iRows;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void Destroy();
|
|
||||||
|
|
||||||
MYSQL_STMT * m_pkStmt;
|
|
||||||
|
|
||||||
std::string m_stQuery;
|
|
||||||
|
|
||||||
std::vector<MYSQL_BIND> m_vec_param;
|
|
||||||
unsigned int m_uiParamCount;
|
|
||||||
uint64_t * m_puiParamLen;
|
|
||||||
|
|
||||||
std::vector<MYSQL_BIND> m_vec_result;
|
|
||||||
unsigned int m_uiResultCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,8 +1,6 @@
|
|||||||
#ifndef __INC_METIN_II_TELLWAIT_H__
|
#ifndef __INC_METIN_II_TELLWAIT_H__
|
||||||
#define __INC_METIN_II_TELLWAIT_H__
|
#define __INC_METIN_II_TELLWAIT_H__
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
|
|
||||||
extern void TELL_WAIT();
|
extern void TELL_WAIT();
|
||||||
|
|
||||||
extern void WAIT_CHILD();
|
extern void WAIT_CHILD();
|
||||||
@ -12,5 +10,3 @@ extern void WAIT_PARENT();
|
|||||||
extern void TELL_PARENT(pid_t pid);
|
extern void TELL_PARENT(pid_t pid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#ifndef __WIN32__
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -8,22 +6,13 @@
|
|||||||
#include "CAsyncSQL.h"
|
#include "CAsyncSQL.h"
|
||||||
|
|
||||||
// TODO: Consider providing platform-independent mutex class.
|
// TODO: Consider providing platform-independent mutex class.
|
||||||
#ifndef __WIN32__
|
|
||||||
#define MUTEX_LOCK(mtx) pthread_mutex_lock(mtx)
|
#define MUTEX_LOCK(mtx) pthread_mutex_lock(mtx)
|
||||||
#define MUTEX_UNLOCK(mtx) pthread_mutex_unlock(mtx)
|
#define MUTEX_UNLOCK(mtx) pthread_mutex_unlock(mtx)
|
||||||
#else
|
|
||||||
#define MUTEX_LOCK(mtx) ::EnterCriticalSection(mtx)
|
|
||||||
#define MUTEX_UNLOCK(mtx) ::LeaveCriticalSection(mtx)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CAsyncSQL::CAsyncSQL()
|
CAsyncSQL::CAsyncSQL()
|
||||||
: m_stHost(""), m_stUser(""), m_stPassword(""), m_stDB(""), m_stLocale(""),
|
: m_stHost(""), m_stUser(""), m_stPassword(""), m_stDB(""), m_stLocale(""),
|
||||||
m_iMsgCount(0), m_bEnd(false),
|
m_iMsgCount(0), m_bEnd(false),
|
||||||
#ifndef __WIN32__
|
|
||||||
m_hThread(0),
|
m_hThread(0),
|
||||||
#else
|
|
||||||
m_hThread(INVALID_HANDLE_VALUE),
|
|
||||||
#endif
|
|
||||||
m_mtxQuery(NULL), m_mtxResult(NULL),
|
m_mtxQuery(NULL), m_mtxResult(NULL),
|
||||||
m_iQueryFinished(0), m_ulThreadID(0), m_bConnected(false), m_iCopiedQuery(0),
|
m_iQueryFinished(0), m_ulThreadID(0), m_bConnected(false), m_iCopiedQuery(0),
|
||||||
m_iPort(0)
|
m_iPort(0)
|
||||||
@ -51,32 +40,20 @@ void CAsyncSQL::Destroy()
|
|||||||
|
|
||||||
if (m_mtxQuery)
|
if (m_mtxQuery)
|
||||||
{
|
{
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_destroy(m_mtxQuery);
|
pthread_mutex_destroy(m_mtxQuery);
|
||||||
#else
|
|
||||||
::DeleteCriticalSection(m_mtxQuery);
|
|
||||||
#endif
|
|
||||||
delete m_mtxQuery;
|
delete m_mtxQuery;
|
||||||
m_mtxQuery = NULL;
|
m_mtxQuery = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_mtxResult)
|
if (m_mtxResult)
|
||||||
{
|
{
|
||||||
#ifndef __WIN32__
|
|
||||||
pthread_mutex_destroy(m_mtxResult);
|
pthread_mutex_destroy(m_mtxResult);
|
||||||
#else
|
|
||||||
::DeleteCriticalSection(m_mtxResult);
|
|
||||||
#endif
|
|
||||||
delete m_mtxResult;
|
delete m_mtxResult;
|
||||||
m_mtxQuery = NULL;
|
m_mtxQuery = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
void * AsyncSQLThread(void * arg)
|
void * AsyncSQLThread(void * arg)
|
||||||
#else
|
|
||||||
unsigned int __stdcall AsyncSQLThread(void* arg)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CAsyncSQL * pSQL = ((CAsyncSQL *) arg);
|
CAsyncSQL * pSQL = ((CAsyncSQL *) arg);
|
||||||
|
|
||||||
@ -198,7 +175,6 @@ bool CAsyncSQL::Setup(const char * c_pszHost, const char * c_pszUser, const char
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#ifndef __WIN32__
|
|
||||||
m_mtxQuery = new pthread_mutex_t;
|
m_mtxQuery = new pthread_mutex_t;
|
||||||
m_mtxResult = new pthread_mutex_t;
|
m_mtxResult = new pthread_mutex_t;
|
||||||
|
|
||||||
@ -215,19 +191,6 @@ bool CAsyncSQL::Setup(const char * c_pszHost, const char * c_pszUser, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_create(&m_hThread, NULL, AsyncSQLThread, this);
|
pthread_create(&m_hThread, NULL, AsyncSQLThread, this);
|
||||||
#else
|
|
||||||
m_mtxQuery = new CRITICAL_SECTION;
|
|
||||||
m_mtxResult = new CRITICAL_SECTION;
|
|
||||||
|
|
||||||
::InitializeCriticalSection(m_mtxQuery);
|
|
||||||
::InitializeCriticalSection(m_mtxResult);
|
|
||||||
|
|
||||||
m_hThread = (HANDLE)::_beginthreadex(NULL, 0, AsyncSQLThread, this, 0, NULL);
|
|
||||||
if (m_hThread == INVALID_HANDLE_VALUE) {
|
|
||||||
perror("CAsyncSQL::Setup");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -240,18 +203,11 @@ void CAsyncSQL::Quit()
|
|||||||
m_bEnd = true;
|
m_bEnd = true;
|
||||||
m_sem.Release();
|
m_sem.Release();
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
if (m_hThread)
|
if (m_hThread)
|
||||||
{
|
{
|
||||||
pthread_join(m_hThread, NULL);
|
pthread_join(m_hThread, NULL);
|
||||||
m_hThread = NULL;
|
m_hThread = NULL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (m_hThread != INVALID_HANDLE_VALUE) {
|
|
||||||
::WaitForSingleObject(m_hThread, INFINITE);
|
|
||||||
m_hThread = INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery)
|
SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "CSemaphore.h"
|
#include "CSemaphore.h"
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
|
|
||||||
CSemaphore::CSemaphore() : m_hSem(NULL)
|
CSemaphore::CSemaphore() : m_hSem(NULL)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -73,70 +71,3 @@ int CSemaphore::Release(int count)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
CSemaphore::CSemaphore() : m_hSem(NULL)
|
|
||||||
{
|
|
||||||
Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
CSemaphore::~CSemaphore()
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSemaphore::Initialize()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
m_hSem = ::CreateSemaphore(NULL, 0, 32, NULL);
|
|
||||||
|
|
||||||
if (m_hSem == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSemaphore::Destroy()
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSemaphore::Clear()
|
|
||||||
{
|
|
||||||
if (m_hSem == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
::CloseHandle(m_hSem);
|
|
||||||
m_hSem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSemaphore::Wait()
|
|
||||||
{
|
|
||||||
if (!m_hSem)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
DWORD dwWaitResult = ::WaitForSingleObject(m_hSem, INFINITE);
|
|
||||||
|
|
||||||
switch (dwWaitResult) {
|
|
||||||
case WAIT_OBJECT_0:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSemaphore::Release(int count)
|
|
||||||
{
|
|
||||||
if (!m_hSem)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
::ReleaseSemaphore(m_hSem, count, NULL);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,159 +0,0 @@
|
|||||||
#include "CStatement.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
CStmt::CStmt()
|
|
||||||
{
|
|
||||||
m_pkStmt = NULL;
|
|
||||||
m_uiParamCount = 0;
|
|
||||||
m_uiResultCount = 0;
|
|
||||||
iRows = 0;
|
|
||||||
m_puiParamLen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CStmt::~CStmt()
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CStmt::Destroy()
|
|
||||||
{
|
|
||||||
if (m_pkStmt)
|
|
||||||
{
|
|
||||||
mysql_stmt_close(m_pkStmt);
|
|
||||||
m_pkStmt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_puiParamLen)
|
|
||||||
{
|
|
||||||
free(m_puiParamLen);
|
|
||||||
m_puiParamLen = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CStmt::Error(const char * c_pszMsg)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("SYSERR: {}: [{}] {}", c_pszMsg, mysql_stmt_errno(m_pkStmt), mysql_stmt_error(m_pkStmt));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CStmt::Prepare(CAsyncSQL * sql, const char * c_pszQuery)
|
|
||||||
{
|
|
||||||
m_pkStmt = mysql_stmt_init(sql->GetSQLHandle());
|
|
||||||
m_stQuery = c_pszQuery;
|
|
||||||
|
|
||||||
if (mysql_stmt_prepare(m_pkStmt, m_stQuery.c_str(), m_stQuery.length()))
|
|
||||||
{
|
|
||||||
Error("mysql_stmt_prepare");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iParamCount = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_stQuery.length(); ++i)
|
|
||||||
if (c_pszQuery[i] == '?')
|
|
||||||
++iParamCount;
|
|
||||||
|
|
||||||
if (iParamCount)
|
|
||||||
{
|
|
||||||
m_vec_param.resize(iParamCount);
|
|
||||||
memset(&m_vec_param[0], 0, sizeof(MYSQL_BIND) * iParamCount);
|
|
||||||
|
|
||||||
m_puiParamLen = (uint64_t *) calloc(iParamCount, sizeof(uint64_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vec_result.resize(48);
|
|
||||||
memset(&m_vec_result[0], 0, sizeof(MYSQL_BIND) * 48);
|
|
||||||
|
|
||||||
if (mysql_stmt_bind_result(m_pkStmt, &m_vec_result[0]))
|
|
||||||
{
|
|
||||||
Error("mysql_stmt_bind_result");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CStmt::BindParam(enum_field_types type, void * p, int iMaxLen)
|
|
||||||
{
|
|
||||||
if (m_uiParamCount >= m_vec_param.size())
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("too many parameter in query: {}", m_stQuery);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_BIND * bind = &m_vec_param[m_uiParamCount];
|
|
||||||
|
|
||||||
bind->buffer_type = type;
|
|
||||||
bind->buffer = (void *) p;
|
|
||||||
bind->buffer_length = iMaxLen;
|
|
||||||
bind->length = m_puiParamLen + m_uiParamCount;
|
|
||||||
|
|
||||||
if (++m_uiParamCount == m_vec_param.size())
|
|
||||||
{
|
|
||||||
if (mysql_stmt_bind_param(m_pkStmt, &m_vec_param[0]))
|
|
||||||
{
|
|
||||||
Error("mysql_stmt_bind_param");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CStmt::BindResult(enum_field_types type, void * p, int iMaxLen)
|
|
||||||
{
|
|
||||||
if (m_uiResultCount >= m_vec_result.size())
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("too many result in query: {}", m_stQuery);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_BIND * bind = &m_vec_result[m_uiResultCount++];
|
|
||||||
|
|
||||||
bind->buffer_type = type;
|
|
||||||
bind->buffer = (void *) p;
|
|
||||||
bind->buffer_length = iMaxLen;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CStmt::Execute()
|
|
||||||
{
|
|
||||||
if (m_uiParamCount != m_vec_param.size())
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("Parameter not enough {}, expected {} query: {}", m_uiParamCount, m_vec_param.size(), m_stQuery);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_uiParamCount; ++i)
|
|
||||||
{
|
|
||||||
MYSQL_BIND * bind = &m_vec_param[i];
|
|
||||||
|
|
||||||
if (bind->buffer_type == MYSQL_TYPE_STRING)
|
|
||||||
{
|
|
||||||
*(m_puiParamLen + i) = strlen((const char *) bind->buffer);
|
|
||||||
SPDLOG_TRACE("param {} len {} buf {}", i, *m_puiParamLen, (const char *) bind->buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mysql_stmt_execute(m_pkStmt))
|
|
||||||
{
|
|
||||||
Error("mysql_stmt_execute");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mysql_stmt_store_result(m_pkStmt))
|
|
||||||
{
|
|
||||||
Error("mysql_store_result");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
iRows = mysql_stmt_num_rows(m_pkStmt);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CStmt::Fetch()
|
|
||||||
{
|
|
||||||
return !mysql_stmt_fetch(m_pkStmt);
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
|||||||
#ifndef __WIN32__
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -82,6 +80,3 @@ void WAIT_CHILD(void)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ typedef uint8_t UBYTE;
|
|||||||
typedef int8_t sbyte;
|
typedef int8_t sbyte;
|
||||||
typedef uint16_t sh_int;
|
typedef uint16_t sh_int;
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
|
|
||||||
typedef uint32_t DWORD;
|
typedef uint32_t DWORD;
|
||||||
typedef uint32_t BOOL;
|
typedef uint32_t BOOL;
|
||||||
typedef uint8_t BYTE;
|
typedef uint8_t BYTE;
|
||||||
@ -19,40 +17,4 @@ typedef uint32_t ULONG;
|
|||||||
typedef int32_t INT;
|
typedef int32_t INT;
|
||||||
typedef uint32_t UINT;
|
typedef uint32_t UINT;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct timezone
|
|
||||||
{
|
|
||||||
int tz_minuteswest; /* minutes west of Greenwich */
|
|
||||||
int tz_dsttime; /* type of dst correction */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef SOCKET socket_t;
|
|
||||||
|
|
||||||
#if !defined(_W64)
|
|
||||||
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
|
||||||
#define _W64 __w64
|
|
||||||
#else
|
|
||||||
#define _W64
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
typedef __int64 ssize_t;
|
|
||||||
#else
|
|
||||||
typedef _W64 int ssize_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Fixed-size integer types
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
|
||||||
typedef __int32 int32_t;
|
|
||||||
typedef unsigned __int32 uint32_t;
|
|
||||||
typedef __int64 int64_t;
|
|
||||||
typedef unsigned __int64 uint64_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef unsigned int uint;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __INC_LIBTHECORE_TYPEDEF_H__
|
#endif // __INC_LIBTHECORE_TYPEDEF_H__
|
||||||
|
@ -120,8 +120,4 @@ extern "C++"
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
extern void gettimeofday(struct timeval* t, struct timezone* dummy);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __INC_UTILS_H__
|
#endif // __INC_UTILS_H__
|
||||||
|
@ -15,12 +15,7 @@ unsigned int thecore_profiler[NUM_PF];
|
|||||||
|
|
||||||
int thecore_init(int fps, HEARTFUNC heartbeat_func)
|
int thecore_init(int fps, HEARTFUNC heartbeat_func)
|
||||||
{
|
{
|
||||||
#if defined(__WIN32__) || defined(__linux__)
|
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
#else
|
|
||||||
srandom(time(0) + getpid() + getuid());
|
|
||||||
srandomdev();
|
|
||||||
#endif
|
|
||||||
signal_setup();
|
signal_setup();
|
||||||
|
|
||||||
thecore_heart = heart_new(1000000 / fps, heartbeat_func);
|
thecore_heart = heart_new(1000000 / fps, heartbeat_func);
|
||||||
|
@ -7,85 +7,6 @@
|
|||||||
#define __LIBTHECORE__
|
#define __LIBTHECORE__
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#if defined(__WIN32__) || defined(__linux__)
|
|
||||||
void signal_setup() {}
|
void signal_setup() {}
|
||||||
void signal_timer_disable() {}
|
void signal_timer_disable() {}
|
||||||
void signal_timer_enable(int timeout_seconds) {}
|
void signal_timer_enable(int timeout_seconds) {}
|
||||||
#elif __FreeBSD__
|
|
||||||
#define RETSIGTYPE void
|
|
||||||
|
|
||||||
RETSIGTYPE reap(int sig)
|
|
||||||
{
|
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
|
||||||
signal(SIGCHLD, reap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RETSIGTYPE checkpointing(int sig)
|
|
||||||
{
|
|
||||||
if (!tics)
|
|
||||||
{
|
|
||||||
sys_err("CHECKPOINT shutdown: tics did not updated.");
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tics = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RETSIGTYPE hupsig(int sig)
|
|
||||||
{
|
|
||||||
shutdowned = true;
|
|
||||||
sys_err("SIGHUP, SIGINT, SIGTERM signal has been received. shutting down.");
|
|
||||||
}
|
|
||||||
|
|
||||||
RETSIGTYPE usrsig(int sig)
|
|
||||||
{
|
|
||||||
core_dump();
|
|
||||||
}
|
|
||||||
|
|
||||||
void signal_timer_disable(void)
|
|
||||||
{
|
|
||||||
struct itimerval itime;
|
|
||||||
struct timeval interval;
|
|
||||||
|
|
||||||
interval.tv_sec = 0;
|
|
||||||
interval.tv_usec = 0;
|
|
||||||
|
|
||||||
itime.it_interval = interval;
|
|
||||||
itime.it_value = interval;
|
|
||||||
|
|
||||||
setitimer(ITIMER_VIRTUAL, &itime, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void signal_timer_enable(int sec)
|
|
||||||
{
|
|
||||||
struct itimerval itime;
|
|
||||||
struct timeval interval;
|
|
||||||
|
|
||||||
interval.tv_sec = sec;
|
|
||||||
interval.tv_usec = 0;
|
|
||||||
|
|
||||||
itime.it_interval = interval;
|
|
||||||
itime.it_value = interval;
|
|
||||||
|
|
||||||
setitimer(ITIMER_VIRTUAL, &itime, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void signal_setup(void)
|
|
||||||
{
|
|
||||||
signal_timer_enable(30);
|
|
||||||
|
|
||||||
signal(SIGVTALRM, checkpointing);
|
|
||||||
|
|
||||||
/* just to be on the safe side: */
|
|
||||||
signal(SIGHUP, hupsig);
|
|
||||||
signal(SIGCHLD, reap);
|
|
||||||
signal(SIGINT, hupsig);
|
|
||||||
signal(SIGTERM, hupsig);
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
signal(SIGALRM, SIG_IGN);
|
|
||||||
signal(SIGUSR1, usrsig);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -210,7 +210,6 @@ struct tm * tm_calc(const struct tm * curr_tm, int days)
|
|||||||
return (&new_tm);
|
return (&new_tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
void thecore_sleep(struct timeval* timeout)
|
void thecore_sleep(struct timeval* timeout)
|
||||||
{
|
{
|
||||||
if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0)
|
if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0)
|
||||||
@ -251,32 +250,6 @@ uint64_t rdtsc()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void thecore_sleep(struct timeval* timeout)
|
|
||||||
{
|
|
||||||
Sleep(timeout->tv_sec * 1000 + timeout->tv_usec / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void thecore_msleep(DWORD dwMillisecond)
|
|
||||||
{
|
|
||||||
Sleep(dwMillisecond);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gettimeofday(struct timeval* t, struct timezone* dummy)
|
|
||||||
{
|
|
||||||
DWORD millisec = GetTickCount();
|
|
||||||
|
|
||||||
t->tv_sec = (millisec / 1000);
|
|
||||||
t->tv_usec = (millisec % 1000) * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
void core_dump_unix(const char *who, WORD line)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float get_float_time()
|
float get_float_time()
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#ifndef __INC_CRC32_H__
|
#ifndef __INC_CRC32_H__
|
||||||
#define __INC_CRC32_H__
|
#define __INC_CRC32_H__
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef unsigned int crc_t;
|
typedef unsigned int crc_t;
|
||||||
|
|
||||||
|
14
vcpkg.json
Normal file
14
vcpkg.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
"cryptopp",
|
||||||
|
"effolkronium-random",
|
||||||
|
"libevent",
|
||||||
|
"lzo",
|
||||||
|
"fmt",
|
||||||
|
"spdlog",
|
||||||
|
"argon2",
|
||||||
|
"libpq",
|
||||||
|
"libpqxx"
|
||||||
|
],
|
||||||
|
"builtin-baseline": "a9eee3b18df395dbb8be71a31bd78ea441056e42"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user