diff --git a/src/db/ClientManagerLogin.cpp b/src/db/ClientManagerLogin.cpp index d0f1186..f352ba8 100644 --- a/src/db/ClientManagerLogin.cpp +++ b/src/db/ClientManagerLogin.cpp @@ -80,24 +80,6 @@ bool CClientManager::FindLogonAccount(const char * c_pszLogin) void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketGDLoginByKey * p) { -#ifdef ENABLE_LIMIT_TIME - static int s_updateCount = 0; - static int s_curTime = time(0); - if (s_updateCount > 100) - { - s_curTime = time(0); - s_updateCount = 0; - } - ++s_updateCount; - - if (s_curTime >= GLOBAL_LIMIT_TIME) - { - sys_err("Server life time expired."); - exit(0); - return; - } -#endif - CLoginData * pkLoginData = GetLoginData(p->dwLoginKey); char szLogin[LOGIN_MAX_LEN + 1]; trim_and_lower(p->szLogin, szLogin, sizeof(szLogin)); diff --git a/src/game/char_manager.cpp b/src/game/char_manager.cpp index aaf6e54..10f2401 100644 --- a/src/game/char_manager.cpp +++ b/src/game/char_manager.cpp @@ -692,15 +692,6 @@ void CHARACTER_MANAGER::Update(int iPulse) for (itertype(m_map_dwMobKillCount) it = m_map_dwMobKillCount.begin(); it != m_map_dwMobKillCount.end(); ++it) DBManager::instance().SendMoneyLog(MONEY_LOG_MONSTER_KILL, it->first, it->second); -#ifdef _USE_SERVER_KEY_ - extern bool Metin2Server_IsInvalid(); - extern bool g_bShutdown; - if (Metin2Server_IsInvalid()) - { - g_bShutdown = true; - } -#endif - m_map_dwMobKillCount.clear(); } diff --git a/src/game/desc.cpp b/src/game/desc.cpp index ac3b5b9..391f6ea 100644 --- a/src/game/desc.cpp +++ b/src/game/desc.cpp @@ -192,16 +192,6 @@ EVENTFUNC(ping_event) desc->SetPong(false); } -#ifdef ENABLE_LIMIT_TIME - if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) - { - extern void ClearAdminPages(); - ClearAdminPages(); - extern g_bShutdown; - g_bShutdown = true; - } -#endif - desc->SendHandshake(get_dword_time(), 0); return (ping_event_second_cycle); diff --git a/src/game/input.cpp b/src/game/input.cpp index 9773e30..1b5908a 100644 --- a/src/game/input.cpp +++ b/src/game/input.cpp @@ -18,10 +18,6 @@ #include "castle.h" #include "dev_log.h" -#ifndef OS_WINDOWS - #include "limit_time.h" -#endif - extern time_t get_global_time(); bool IsEmptyAdminPage() @@ -39,14 +35,6 @@ bool IsAdminPage(const char * ip) return 0; } -void ClearAdminPages() -{ - for (size_t n = 0; n < g_stAdminPageIP.size(); ++n) - g_stAdminPageIP[n].clear(); - - g_stAdminPageIP.clear(); -} - CInputProcessor::CInputProcessor() : m_pPacketInfo(NULL), m_iBufferLeft(0) { if (!m_pPacketInfo) @@ -174,17 +162,6 @@ bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, void CInputProcessor::Pong(LPDESC d) { d->SetPong(true); - - extern bool Metin2Server_IsInvalid(); - -#ifdef ENABLE_LIMIT_TIME - if (Metin2Server_IsInvalid()) - { - extern bool g_bShutdown; - g_bShutdown = true; - ClearAdminPages(); - } -#endif } void CInputProcessor::Handshake(LPDESC d, const char * c_pData) diff --git a/src/game/input_auth.cpp b/src/game/input_auth.cpp index d3e2c71..3b628b9 100644 --- a/src/game/input_auth.cpp +++ b/src/game/input_auth.cpp @@ -10,10 +10,6 @@ #include "auth_brazil.h" #include "db.h" -#ifndef OS_WINDOWS - #include "limit_time.h" -#endif - extern time_t get_global_time(); bool FN_IS_VALID_LOGIN_STRING(const char *str) @@ -107,17 +103,6 @@ CInputAuth::CInputAuth() void CInputAuth::Login(LPDESC d, const char * c_pData) { - extern bool Metin2Server_IsInvalid(); - -#ifdef ENABLE_LIMIT_TIME - if (Metin2Server_IsInvalid()) - { - extern void ClearAdminPages(); - ClearAdminPages(); - exit(1); - return; - } -#endif TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) c_pData; if (!g_bAuthServer) diff --git a/src/game/limit_time.h b/src/game/limit_time.h deleted file mode 100644 index 68f684e..0000000 --- a/src/game/limit_time.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __LIMIT_TIME__ -#define __LIMIT_TIME__ - -// #define ENABLE_LIMIT_TIME -#define GLOBAL_LIMIT_TIME 1684265966UL // Tue May 16 21:39:26 2023 -#define TIME_OVER_PONG_DOWN_RATE 50000 -#define TIME_OVER_LOGIN_DOWN_RATE 10000 -#endif diff --git a/src/game/main.cpp b/src/game/main.cpp index 5004c0f..6ab5a09 100644 --- a/src/game/main.cpp +++ b/src/game/main.cpp @@ -59,9 +59,6 @@ #include "skill_power.h" #include "SpeedServer.h" #include "DragonSoul.h" -#ifndef OS_WINDOWS - #include "limit_time.h" -#endif // #ifndef OS_WINDOWS // #include @@ -71,11 +68,6 @@ #include #endif -// 윈도우에서 테스트할 때는 항상 서버키 체크 -#ifdef _WIN32 - //#define _USE_SERVER_KEY_ -#endif - extern void WriteVersion(); //extern const char * _malloc_options; #if defined(OS_FREEBSD) && defined(DEBUG_ALLOC) @@ -231,13 +223,6 @@ void heartbeat(LPHEART ht, int pulse) // 1초마다 if (!(pulse % ht->passes_per_sec)) { -#ifdef ENABLE_LIMIT_TIME - if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) - { - g_bShutdown = true; - } -#endif - if (g_bAuthServer && LC_IsBrazil() && !test_server) auth_brazil_log(); @@ -325,87 +310,6 @@ void heartbeat(LPHEART ht, int pulse) } } -static bool g_isInvalidServer = false; - -bool Metin2Server_IsInvalid() -{ - return g_isInvalidServer; -} - -void Metin2Server_Check() -{ -#ifdef _SERVER_CHECK_ - -#ifdef _USE_SERVER_KEY_ - if (false == CheckServer::CheckIp(g_szPublicIP)) - { -#ifdef _WIN32 - fprintf(stderr, "check ip failed\n"); -#endif - g_isInvalidServer = true; - } - return; -#endif - - if (LC_IsEurope() || test_server) - return; - - - // 브라질 ip - if (strncmp (g_szPublicIP, "189.112.1", 9) == 0) - { - return; - } - - // 캐나다 ip - if (strncmp (g_szPublicIP, "74.200.6", 8) == 0) - { - return; - } - - return; - - static const size_t CheckServerListSize = 1; - static const char* CheckServerList[] = { "202.31.178.251"}; - static const int CheckServerPort = 7120; - - socket_t sockConnector = INVALID_SOCKET; - - for (size_t i = 0 ; i < CheckServerListSize ; i++) - { - sockConnector = socket_connect( CheckServerList[i], CheckServerPort ); - - if (0 < sockConnector) - break; - } - - if (0 > sockConnector) - { - if (true != LC_IsEurope()) // 유럽은 접속을 하지 못하면 인증된 것으로 간주 - g_isInvalidServer = true; - - return; - } - - char buf[256] = { 0, }; - - socket_read(sockConnector, buf, sizeof(buf) - 1); - - sys_log(0, "recv[%s]", buf); - - if (strncmp(buf, "OK", 2) == 0) - g_isInvalidServer = false; - else if (strncmp(buf, "CK", 2) == 0) - g_isInvalidServer = true; - - socket_close(sockConnector); -#else - g_isInvalidServer = false; - return; -#endif - -} - static void CleanUpForEarlyExit() { CancelReloadSpamEvent(); } @@ -504,15 +408,6 @@ int main(int argc, char **argv) ani_init(); PanamaLoad(); - Metin2Server_Check(); - -#if defined(_WIN32) && defined(_USE_SERVER_KEY_) - if (CheckServer::IsFail()) - { - return 1; - } -#endif - if ( g_bTrafficProfileOn ) TrafficProfiler::instance().Initialize( TRAFFIC_PROFILE_FLUSH_CYCLE, "ProfileLog" ); @@ -615,12 +510,6 @@ int start(int argc, char **argv) #if defined(OS_FREEBSD) && defined(DEBUG_ALLOC) _malloc_message = WriteMallocMessage; #endif -#ifdef ENABLE_LIMIT_TIME - if ((unsigned)get_global_time() >= GLOBAL_LIMIT_TIME) - { - return 0; - } -#endif char optstring[] = "npverltI"; while ((ch = getopt(argc, argv, optstring)) != -1) @@ -855,12 +744,6 @@ int idle() memset(&thecore_profiler[0], 0, sizeof(thecore_profiler)); memset(&s_dwProfiler[0], 0, sizeof(s_dwProfiler)); } -#ifdef _USE_SERVER_KEY_ - if (Metin2Server_IsInvalid() && 0 == (thecore_random() % 7146)) - { - return 0; // shutdown - } -#endif #ifdef OS_WINDOWS if (_kbhit()) {