Revert "const"
authorCryptoManiac <balthazar@yandex.ru>
Tue, 22 Sep 2015 19:36:15 +0000 (22:36 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Tue, 22 Sep 2015 19:36:15 +0000 (22:36 +0300)
This reverts commit 337a66b52c0296b218bdd0f2e24a84a0d451fb11.

src/ntp.cpp
src/ntp.h

index bae50d9..60cc309 100644 (file)
@@ -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<CNetAddr> 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<int64_t> 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++)
index 8cf3be6..6ec9191 100644 (file)
--- 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;