Honorable Member Owsap 8174 Posted July 24, 2021 Honorable Member Share Posted July 24, 2021 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( GitHub ) This is the hidden content, please Sign In or Sign Up ( MEGA ) This is the hidden content, please Sign In or Sign Up ( Internal ) Hey M2Dev, here is a little statistics overview of the Round Trip Time (RTT) Ping and Packet Loss. Usefully for some, useless for others, so I decided to share it. Preview The image is an example... The results where not captured accurately because they kept updating while I tried to take screenshots. You will not get any PING on localhost. If you find any problems let me know. Edited July 24, 2021 by Owsap Links & Repository Updated. 137 2 2 1 4 1 1 28 3 74 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
UdvAtt108 100 Posted July 24, 2021 Share Posted July 24, 2021 There is a nice memory leak, that spammed in every 5 seconds and makes high memory usage few hours later... Please, be carefull when you use memory allocations... Easy to fix it, lets correct it. 1 1 All wolves are gray in the dark. Link to comment Share on other sites More sharing options...
luqurote 0 Posted July 24, 2021 Share Posted July 24, 2021 1 hour ago, UdvAtt108 said: There is a nice memory leak, that spammed in every 5 seconds and makes high memory usage few hours later... Please, be carefull when you use memory allocations... Easy to fix it, lets correct it. please share fix Link to comment Share on other sites More sharing options...
UdvAtt108 100 Posted July 24, 2021 Share Posted July 24, 2021 (edited) 41 minutes ago, luqurote said: please share fix In ServerStateChecker.cpp file, end of CServerStateChecker::GetEchoReply function: Replace the following: return; with it: free(ReplyBuffer); Edit: Or you can use fixed static variable as buffer, that is should be better in this case. Edited July 24, 2021 by UdvAtt108 All wolves are gray in the dark. Link to comment Share on other sites More sharing options...
Jimmermania 27 Posted July 24, 2021 Share Posted July 24, 2021 I have this sysser: 0724 13:48:16827 :: UISCRIPT_LOAD_ERROR: can only concatenate tuple (not "list") to tuple [filename UIScript/MiniMap.py] 0724 13:48:16829 :: uiMiniMap.py(line:341) __LoadWindow ui.py(line:3740) GetChild MiniMap.LoadWindow.Bind - <type 'exceptions.KeyError'>:'RTTTextLine' Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8174 Posted July 24, 2021 Author Honorable Member Share Posted July 24, 2021 (edited) 12 hours ago, UdvAtt108 said: There is a nice memory leak, that spammed in every 5 seconds and makes high memory usage few hours later... Please, be carefull when you use memory allocations... Easy to fix it, lets correct it. Glad someone had to point that out, obviously, every allocation must be freed after using it but I wasn’t sure if IcmpSendEcho2 function cleared it for me, but honestly, I forgot about it. Since you had good eyes in pointing that out, you also forgot to mention to close the IcmpFile HANDLE. 7 hours ago, Jimmermania said: I have this sysser: 0724 13:48:16827 :: UISCRIPT_LOAD_ERROR: can only concatenate tuple (not "list") to tuple [filename UIScript/MiniMap.py] 0724 13:48:16829 :: uiMiniMap.py(line:341) __LoadWindow ui.py(line:3740) GetChild MiniMap.LoadWindow.Bind - <type 'exceptions.KeyError'>:'RTTTextLine' The file in the tutorial "UIScript/MiniMap.py" already contains the correct structure to attach more children in the window. If you didn't use the file you can do this (2 options); Spoiler ''' 1. @ UIScript/MiniMap.py ''' # Search all "children" : ( ... ), # Replace with "children" : [ ... ], Or you can just add; Spoiler ''' 1. @ UIScript/MiniMap.py ''' # Search ## ServerInfo { "name" : "ServerInfo", "type" : "text", "text_horizontal_align" : "center", "outline" : 1, "x" : 70, "y" : 140, "text" : "", }, # Add below ## RTT Statistics { "name" : "RTTTextLine", "type" : "text", "x" : 0, "y" : 160, "horizontal_align" : "center", "text_horizontal_align" : "center", "text" : "", "outline" : 1, }, { "name" : "PacketLossTextLine", "type" : "text", "x" : 0, "y" : 160 + 15, "horizontal_align" : "center", "text_horizontal_align" : "center", "text" : "", "outline" : 1, }, Links & Repository Updated. Edited July 24, 2021 by Owsap 2 1 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
sociopat32 2 Posted August 17, 2021 Share Posted August 17, 2021 (edited) I'm getting this thing .... Does anyone have an idea? Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted September 11, 2021 Management Share Posted September 11, 2021 (edited) First of all, thank you for this release. Since I use a hostname instead of an IP, this didn't work for me, this are the changes I made to make it work (also works with IP). CAccountConnector& rkAccountConnector = CAccountConnector::Instance(); struct hostent* remoteHost; if ((remoteHost = gethostbyname(rkAccountConnector.GetServerAddr())) == NULL) { #if defined(_DEBUG_RTT) TraceError("Unknown Hostname.\n\n"); #endif return; // Unkown Hostname } char* pDmsIP = inet_ntoa(*(struct in_addr*)(remoteHost->h_addr_list[0])); ipaddr = inet_addr(pDmsIP); Edited September 11, 2021 by Karbust 1 Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8174 Posted September 11, 2021 Author Honorable Member Share Posted September 11, 2021 28 minutes ago, Karbust said: First of all, thank you for this release. Since I use a hostname instead of an IP, this didn't work for me, this are the changes I made to make it work (also works with IP). CAccountConnector& rkAccountConnector = CAccountConnector::Instance(); struct hostent* remoteHost; if ((remoteHost = gethostbyname(rkAccountConnector.GetServerAddr())) == NULL) { #if defined(_DEBUG_RTT) TraceError("Unknown Hostname.\n\n"); #endif return; // Unkown Hostname } char* pDmsIP = inet_ntoa(*(struct in_addr*)(remoteHost->h_addr_list[0])); ipaddr = inet_addr(pDmsIP); Thanks for contributing, I will update the repository soon. https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
sociopat32 2 Posted September 11, 2021 Share Posted September 11, 2021 (edited) On 8/17/2021 at 1:23 PM, sociopat32 said: I'm getting this thing .... Does anyone have an idea? Up! Edited August 17, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Kafa 153 Posted January 6, 2022 Share Posted January 6, 2022 On 9/11/2021 at 10:54 PM, sociopat32 said: Up! I'm having the same issue on my windowsfiles. Also there is a screen freeze every 4th second. @ Owsap Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted January 11, 2022 Management Share Posted January 11, 2022 (edited) Since not everyone has a good internet and there are instances when someone can have high ping, I think it shouldn't affect the game play capability in such cases, so I just added the ping code to a thread and now it doesn't block the game. This is the hidden content, please Sign In or Sign Up Edited July 20, 2022 by Karbust 50 8 2 13 Link to comment Share on other sites More sharing options...
Jimmermania 27 Posted July 26, 2022 Share Posted July 26, 2022 (edited) I got this error: BUG Any ideas? Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
davecosmo 9 Posted October 15, 2022 Share Posted October 15, 2022 (edited) On 9/11/2021 at 7:46 PM, Karbust said: First of all, thank you for this release. Since I use a hostname instead of an IP, this didn't work for me, this are the changes I made to make it work (also works with IP). CAccountConnector& rkAccountConnector = CAccountConnector::Instance(); struct hostent* remoteHost; if ((remoteHost = gethostbyname(rkAccountConnector.GetServerAddr())) == NULL) { #if defined(_DEBUG_RTT) TraceError("Unknown Hostname.\n\n"); #endif return; // Unkown Hostname } char* pDmsIP = inet_ntoa(*(struct in_addr*)(remoteHost->h_addr_list[0])); ipaddr = inet_addr(pDmsIP); Hi all, since my good friend @ Karbust forgot to mention (this mod work well btw and ty both), I've come to let you my small contribution, explaining how to implement. His mod is done like this: After implemented the full mod as @ Owsap explain, open the file Client source -> in file ServerStateChecker.cpp Search for: ipaddr = inet_addr(strcmp(rkAccountConnector.GetServerAddr(), "localhost") == 0 ? "127.0.0.1" : rkAccountConnector.GetServerAddr()); and replace that* line (just that one) with all these given by @ Karbust : struct hostent* remoteHost; if ((remoteHost = gethostbyname(rkAccountConnector.GetServerAddr())) == NULL) { #if defined(_DEBUG_RTT) TraceError("Unknown Hostname.\n\n"); #endif return; // Unkown Hostname } char* pDmsIP = inet_ntoa(*(struct in_addr*)(remoteHost->h_addr_list[0])); ipaddr = inet_addr(pDmsIP); Work just fine for me. EDIT: @Jimmermania you must have missed a step somewhere, verify again, or rollback to a previous backup and restart again. Edited October 15, 2022 by davecosmo 1 1 Link to comment Share on other sites More sharing options...
Debloat 88 Posted May 16, 2023 Share Posted May 16, 2023 (edited) Thank you, it works. Edited May 16, 2023 by Debloat Link to comment Share on other sites More sharing options...
Premium DemOnJR 564 Posted August 16, 2023 Premium Share Posted August 16, 2023 Tested and is working. If you get the error with thread on compilation just add std::thread like in this example: #if defined(ENABLE_PERFORMANCE_STATISTICS) static DWORD s_dwCheckPingTime = ELTimer_GetMSec(); if (ELTimer_GetMSec() - s_dwCheckPingTime > CServerStateChecker::MAX_RTT_REQUEST_MS) { std::thread t(NonBlockingServerStateChecker, &m_kServerStateChecker, &m_dwRTT, &m_fPktLossPct, &s_dwCheckPingTime); t.detach(); } #endif Also if the ms is 999ms you need to allow IMCP traffic on your FIREWALL. And done. Link to comment Share on other sites More sharing options...
ZentraX 5 Posted August 16, 2023 Share Posted August 16, 2023 (edited) 4 hours ago, DemOnJR said: Tested and is working. If you get the error with thread on compilation just add std::thread like in this example: #if defined(ENABLE_PERFORMANCE_STATISTICS) static DWORD s_dwCheckPingTime = ELTimer_GetMSec(); if (ELTimer_GetMSec() - s_dwCheckPingTime > CServerStateChecker::MAX_RTT_REQUEST_MS) { std::thread t(NonBlockingServerStateChecker, &m_kServerStateChecker, &m_dwRTT, &m_fPktLossPct, &s_dwCheckPingTime); t.detach(); } #endif Also if the ms is 999ms you need to allow IMCP traffic on your FIREWALL. And done. How about adding an task with std::async? I would prefer it with a promise like this: private: std::future<int32_t> m_pingTask{}; int32_t m_ping{}; public: // easy running in background :_D void Ping() { // Task is already running if (m_pingTask.valid()) return; m_pingTask = std::async(std::launch::async, []() { /*... Perform ping request here */ return ping;}); } void UpdatePing() { if (m_pingTask.valid()) { const auto status = m_pingTask.wait_until(std::chrono::system_clock::now() + std::chrono::seconds(0)); // 0 not timeout if the task is done here if (status == std::future_status::ready) // ready means the task is done { m_ping = m_pingTask.get(); // here you can get the like use python create a func for it like app.GetPing() and return this value here m_pingTask = {}; } } } int32_t GetPing() const { return m_ping; } Edited August 16, 2023 by ZentraX Link to comment Share on other sites More sharing options...
Premium DemOnJR 564 Posted August 16, 2023 Premium Share Posted August 16, 2023 Spoiler 16 minutes ago, ZentraX said: How about adding an task with std::async? I would prefer it with a promise like this: private: std::future<int32_t> m_pingTask{}; int32_t m_ping{}; public: // easy running in background :_D void Ping() { // Task is already running if (m_pingTask.valid()) return; m_pingTask = std::async(std::launch::async, []() { /*... Perform ping request here */ return ping;}); } void UpdatePing() { if (m_pingTask.valid()) { const auto status = m_pingTask.wait_until(std::chrono::system_clock::now() + std::chrono::seconds(0)); // 0 not timeout if the task is done here if (status == std::future_status::ready) // ready means the task is done { m_ping = m_pingTask.get(); // here you can get the like use python create a func for it like app.GetPing() and return this value here m_pingTask = {}; } } } int32_t GetPing() const { return m_ping; } Idk you can try to use async also is your choice, i do not use boost so thread is ok. Link to comment Share on other sites More sharing options...
Active+ Member Lycawn 516 Posted December 27, 2023 Active+ Member Share Posted December 27, 2023 (edited) thread t(NonBlockingServerStateChecker, &m_kServerStateChecker, &m_dwRTT, &m_fPktLossPct, &s_dwCheckPingTime); t.detach(); for the fix while i am using older source need to clarify std::thread . Edited December 27, 2023 by Lycawn Link to comment Share on other sites More sharing options...
Rodrigo152 4 Posted January 18 Share Posted January 18 (edited) Can anyone help me with this syserr error 0117 20:31:09259 :: networkModule.py(line:197) SetSelectCharacterPhase system.py(line:177) __hybrid_import system.py(line:142) _process_result introSelect.py(line:28) <module> system.py(line:177) __hybrid_import system.py(line:142) _process_result interfaceModule.py(line:27) <module> system.py(line:177) __hybrid_import networkModule.SetSelectCharacterPhase - <type 'exceptions.IndentationError'>:unindent does not match any outer indentation level (uiMiniMap.py, line 395) 0117 20:31:09259 :: ============================================================================================================ 0117 20:31:09259 :: Abort!!!! Edited January 18 by Metin2 Dev International Core X - External 2 Internal 1 1 1 Link to comment Share on other sites More sharing options...
Premium TAUMP 839 Posted January 18 Premium Share Posted January 18 TABS Link to comment Share on other sites More sharing options...
Rodrigo152 4 Posted January 27 Share Posted January 27 (edited) I did as you said, but it returned the following error: Quote 0127 13:40:05685 :: Ping statistics for 51.81.90.206: 0127 13:40:05685 :: Packets: Sent = 1, Received = 1, Lost = 0 (0.00% loss), 0127 13:40:07239 :: networkModule.py(line:197) SetSelectCharacterPhase system.py(line:177) __hybrid_import system.py(line:142) _process_result introSelect.py(line:28) <module> system.py(line:177) __hybrid_import system.py(line:142) _process_result interfaceModule.py(line:27) <module> system.py(line:177) __hybrid_import networkModule.SetSelectCharacterPhase - <type 'exceptions.SyntaxError'>:invalid syntax (uiMiniMap.py, line 340) 0127 13:40:07239 :: ============================================================================================================ 0127 13:40:07239 :: Abort!!!! Edited January 27 by Metin2 Dev International Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts