From 4ad19b65ee94035ec0b976e715d5ddb0ea778649 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Tue, 22 Sep 2015 22:36:15 +0300 Subject: [PATCH] Revert "const" This reverts commit 337a66b52c0296b218bdd0f2e24a84a0d451fb11. --- src/ntp.cpp | 12 ++++++------ src/ntp.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ntp.cpp b/src/ntp.cpp index bae50d9..60cc309 100644 --- a/src/ntp.cpp +++ b/src/ntp.cpp @@ -81,7 +81,7 @@ struct pkt { const int nServersCount = 147; -const std::string NtpServers[147] = { +std::string NtpServers[147] = { // Microsoft "time.windows.com", @@ -262,7 +262,7 @@ const std::string NtpServers[147] = { // ... To be continued }; -bool InitWithHost(const std::string &strHostName, SOCKET &sockfd, socklen_t &servlen, struct sockaddr *pcliaddr) { +bool InitWithHost(std::string &strHostName, SOCKET &sockfd, socklen_t &servlen, struct sockaddr *pcliaddr) { sockfd = -1; std::vector vIP; @@ -391,7 +391,7 @@ int64_t NtpGetTime(CNetAddr& ip) { return nTime; } -int64_t NtpGetTime(const std::string &strHostName) +int64_t NtpGetTime(std::string &strHostName) { struct sockaddr cliaddr; @@ -426,7 +426,7 @@ void ThreadNtpSamples(void* parg) { printf("Trying to find NTP server at localhost...\n"); - const std::string strLocalHost = "127.0.0.1"; + std::string strLocalHost = "127.0.0.1"; if (NtpGetTime(strLocalHost) == GetTime()) { printf("There is NTP server active at localhost, we don't need NTP thread.\n"); @@ -443,7 +443,7 @@ void ThreadNtpSamples(void* parg) { CMedianFilter vTimeOffsets(200,0); while (!fShutdown) { - if (strTrustedUpstream != strLocalHost) { + if (strTrustedUpstream != "localhost") { // Trying to get new offset sample from trusted NTP server. int64_t nClockOffset = NtpGetTime(strTrustedUpstream) - GetTime(); @@ -455,7 +455,7 @@ void ThreadNtpSamples(void* parg) { else { // Something went wrong, disable trusted offset sampling. nNtpOffset = INT64_MAX; - strTrustedUpstream = strLocalHost; + strTrustedUpstream = "localhost"; int nSleepMinutes = 1 + GetRandInt(9); // Sleep for 1-10 minutes. for (int i = 0; i < nSleepMinutes * 60 && !fShutdown; i++) diff --git a/src/ntp.h b/src/ntp.h index 8cf3be6..6ec9191 100644 --- a/src/ntp.h +++ b/src/ntp.h @@ -2,7 +2,7 @@ int64_t NtpGetTime(CNetAddr& ip); // Get time from provided server. -int64_t NtpGetTime(const std::string &strHostName); +int64_t NtpGetTime(std::string &strHostName); extern std::string strTrustedUpstream; -- 1.7.1