diff --git a/ChangeLog b/ChangeLog index dd1bac57..67f076fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ # for this file format description, # see https://github.com/olivierlacan/keep-a-changelog +## [2.10.2] - 2016-12-04 +### Fixed +- Fixes UPnP discovery bug, producing excessive CPU usage +- Fixes sudden SSU thread stop for Windows. + ## [2.10.1] - 2016-11-07 ### Fixed - Fixed some performance issues for Windows and Android diff --git a/NetDb.cpp b/NetDb.cpp index e75cf217..a1f0fcb7 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -118,7 +118,6 @@ namespace data { SaveUpdated (); ManageLeaseSets (); - ManageLookupResponses (); } lastSave = ts; } @@ -857,33 +856,17 @@ namespace data } if (!replyMsg) - { - LogPrint (eLogWarning, "NetDb: Requested ", key, " not found, ", numExcluded, " peers excluded"); - // find or cleate response - std::vector closestFloodfills; - bool found = false; - if (!numExcluded) - { - auto it = m_LookupResponses.find (ident); - if (it != m_LookupResponses.end ()) - { - closestFloodfills = it->second.first; - found = true; - } - } - if (!found) - { - std::set excludedRouters; - const uint8_t * exclude_ident = excluded; - for (int i = 0; i < numExcluded; i++) - { - excludedRouters.insert (exclude_ident); - exclude_ident += 32; - } - closestFloodfills = GetClosestFloodfills (ident, 3, excludedRouters, true); - if (!numExcluded) // save if no excluded - m_LookupResponses[ident] = std::make_pair(closestFloodfills, i2p::util::GetSecondsSinceEpoch ()); + { + std::set excludedRouters; + const uint8_t * exclude_ident = excluded; + for (int i = 0; i < numExcluded; i++) + { + excludedRouters.insert (exclude_ident); + exclude_ident += 32; } + auto closestFloodfills = GetClosestFloodfills (ident, 3, excludedRouters, true); + if (closestFloodfills.empty ()) + LogPrint (eLogWarning, "NetDb: Requested ", key, " not found, ", numExcluded, " peers excluded"); replyMsg = CreateDatabaseSearchReply (ident, closestFloodfills); } } @@ -1191,17 +1174,5 @@ namespace data ++it; } } - - void NetDb::ManageLookupResponses () - { - auto ts = i2p::util::GetSecondsSinceEpoch (); - for (auto it = m_LookupResponses.begin (); it != m_LookupResponses.end ();) - { - if (ts > it->second.second + 180) // 3 minutes - it = m_LookupResponses.erase (it); - else - ++it; - } - } } } diff --git a/NetDb.h b/NetDb.h index 954cc74e..0a05c143 100644 --- a/NetDb.h +++ b/NetDb.h @@ -112,7 +112,6 @@ namespace data void Publish (); void ManageLeaseSets (); void ManageRequests (); - void ManageLookupResponses (); void ReseedFromFloodfill(const RouterInfo & ri, int numRouters=40, int numFloodfills=20); @@ -143,8 +142,7 @@ namespace data /** router info we are bootstrapping from or nullptr if we are not currently doing that*/ std::shared_ptr m_FloodfillBootstrap; - - std::map, uint64_t> > m_LookupResponses; // ident->(closest FFs, timestamp) + /** true if in hidden mode */ bool m_HiddenMode; diff --git a/TunnelEndpoint.cpp b/TunnelEndpoint.cpp index 23cf16f3..b4ddc109 100644 --- a/TunnelEndpoint.cpp +++ b/TunnelEndpoint.cpp @@ -116,6 +116,7 @@ namespace tunnel if (!isFollowOnFragment) // create new incomlete message { m.nextFragmentNum = 1; + m.receiveTime = i2p::util::GetMillisecondsSinceEpoch (); auto ret = m_IncompleteMessages.insert (std::pair(msgID, m)); if (ret.second) HandleOutOfSequenceFragments (msgID, ret.first->second); @@ -284,6 +285,14 @@ namespace tunnel else ++it; } + // incomplete messages + for (auto it = m_IncompleteMessages.begin (); it != m_IncompleteMessages.end ();) + { + if (ts > it->second.receiveTime + i2p::I2NP_MESSAGE_EXPIRATION_TIMEOUT) + it = m_IncompleteMessages.erase (it); + else + ++it; + } } } } diff --git a/TunnelEndpoint.h b/TunnelEndpoint.h index 60c4fc0a..e13ced34 100644 --- a/TunnelEndpoint.h +++ b/TunnelEndpoint.h @@ -15,6 +15,7 @@ namespace tunnel { struct TunnelMessageBlockEx: public TunnelMessageBlock { + uint64_t receiveTime; // milliseconds since epoch uint8_t nextFragmentNum; }; diff --git a/Win32/installer.iss b/Win32/installer.iss index d51ae7f2..047263cc 100644 --- a/Win32/installer.iss +++ b/Win32/installer.iss @@ -1,5 +1,5 @@ #define I2Pd_AppName "i2pd" -#define I2Pd_ver "2.10.1" +#define I2Pd_ver "2.10.2" #define I2Pd_Publisher "PurpleI2P" [Setup] diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index afe7e118..9ffb1c13 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="2.10.2"> diff --git a/debian/changelog b/debian/changelog index f71b2e4a..6e6a4c09 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +i2pd (2.10.2-1) unstable; urgency=low + + * updated to version 2.10.2 + + -- orignal Sun, 4 Dec 2016 19:38:30 +0000 + i2pd (2.10.1-1) unstable; urgency=low * updated to version 2.10.1 diff --git a/version.h b/version.h index 9aadf505..ef88cbcb 100644 --- a/version.h +++ b/version.h @@ -8,7 +8,7 @@ #define I2PD_VERSION_MAJOR 2 #define I2PD_VERSION_MINOR 10 -#define I2PD_VERSION_MICRO 1 +#define I2PD_VERSION_MICRO 2 #define I2PD_VERSION_PATCH 0 #define I2PD_VERSION MAKE_VERSION(I2PD_VERSION_MAJOR, I2PD_VERSION_MINOR, I2PD_VERSION_MICRO) #define VERSION I2PD_VERSION