1- // Copyright (c) 2022-2023 The Pastel Core developers
1+ // Copyright (c) 2022-2024 The Pastel Core developers
22// Distributed under the MIT software license, see the accompanying
33// file COPYING or https://www.opensource.org/licenses/mit-license.php.
44#include < utils/ping_util.h>
99using namespace std ;
1010using namespace chrono ;
1111
12- CPingUtility::CPingUtility () :
12+ CPingUtility::CPingUtility () noexcept :
1313 m_bPingUtilityChecked(false ),
14- m_bPingUtilityAvailable(false )
14+ m_bPingUtilityAvailable(false ),
15+ m_bPingUtilityFound(false )
1516{}
1617
1718bool CPingUtility::pingHostInternal (const std::string& sHostName )
@@ -34,6 +35,7 @@ CPingUtility::PingResult CPingUtility::pingHost(const string& sHostName)
3435 if (!m_bPingUtilityAvailable)
3536 {
3637 LogPrintf (" %s\n " , error);
38+ m_bPingUtilityFound = false ;
3739 }
3840 m_bPingUtilityChecked = true ;
3941 m_lastCheckTime = steady_clock::now ();
@@ -67,7 +69,11 @@ bool CPingUtility::checkPingUtility(string &error)
6769 }
6870
6971 m_sPingPath = stdOut;
70- LogPrintf (" Found ping utility at [%s]\n " , m_sPingPath);
72+ if (!m_bPingUtilityFound)
73+ {
74+ LogPrintf (" Found ping utility at [%s]\n " , m_sPingPath);
75+ m_bPingUtilityFound = true ;
76+ }
7177 if (!pingHostInternal (" 127.0.0.1" ))
7278 {
7379 error = " Ping utility is not working" ;
0 commit comments