diff --git a/.travis.yml b/.travis.yml index d83cdbc0..819c75f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ cache: apt: true os: - linux - - osx sudo: required dist: trusty addons: diff --git a/NetDb.cpp b/NetDb.cpp index 1752f1a9..6ef5df7f 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -71,7 +71,7 @@ namespace data void NetDb::Run () { - uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0, lastManageRequest = 0; + uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0, lastManageRequest = 0, lastDestinationCleanup = 0; while (m_IsRunning) { try @@ -121,7 +121,11 @@ namespace data } lastSave = ts; } - + if (ts - lastDestinationCleanup >= i2p::garlic::INCOMING_TAGS_EXPIRATION_TIMEOUT) + { + i2p::context.CleanupDestination (); + lastDestinationCleanup = ts; + } // if we're in hidden mode don't publish or explore // if (m_HiddenMode) continue; diff --git a/RouterContext.cpp b/RouterContext.cpp index f2c2bc48..3b16d81a 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -439,6 +439,12 @@ namespace i2p std::unique_lock l(m_GarlicMutex); i2p::garlic::GarlicDestination::ProcessDeliveryStatusMessage (msg); } + + void RouterContext::CleanupDestination () + { + std::unique_lock l(m_GarlicMutex); + i2p::garlic::GarlicDestination::CleanupExpiredTags (); + } uint32_t RouterContext::GetUptime () const { diff --git a/RouterContext.h b/RouterContext.h index 05339847..27e0947d 100644 --- a/RouterContext.h +++ b/RouterContext.h @@ -71,7 +71,8 @@ namespace i2p void SetSupportsV4 (bool supportsV4); void UpdateNTCPV6Address (const boost::asio::ip::address& host); // called from NTCP session - void UpdateStats (); + void UpdateStats (); + void CleanupDestination (); // garlic destination // implements LocalDestination std::shared_ptr GetIdentity () const { return m_Keys.GetPublic (); }; diff --git a/UPnP.cpp b/UPnP.cpp index 41b49e00..db0d3683 100644 --- a/UPnP.cpp +++ b/UPnP.cpp @@ -49,7 +49,9 @@ namespace transport m_IsRunning = true; LogPrint(eLogInfo, "UPnP: starting"); m_Service.post (std::bind (&UPnP::Discover, this)); + std::unique_lock l(m_StartedMutex); m_Thread.reset (new std::thread (std::bind (&UPnP::Run, this))); + m_Started.wait_for (l, std::chrono::seconds (5)); // 5 seconds maximum } UPnP::~UPnP () @@ -80,7 +82,12 @@ namespace transport #else m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror); #endif - + { + // notify satrting thread + std::unique_lock l(m_StartedMutex); + m_Started.notify_all (); + } + int r; r = UPNP_GetValidIGD (m_Devlist, &m_upnpUrls, &m_upnpData, m_NetworkAddr, sizeof (m_NetworkAddr)); if (r == 1) diff --git a/UPnP.h b/UPnP.h index f62ce402..7d67fdbf 100644 --- a/UPnP.h +++ b/UPnP.h @@ -4,6 +4,8 @@ #ifdef USE_UPNP #include #include +#include +#include #include #include @@ -43,8 +45,10 @@ namespace transport bool m_IsRunning; std::unique_ptr m_Thread; + std::condition_variable m_Started; + std::mutex m_StartedMutex; boost::asio::io_service m_Service; - boost::asio::deadline_timer m_Timer; + boost::asio::deadline_timer m_Timer; struct UPNPUrls m_upnpUrls; struct IGDdatas m_upnpData; diff --git a/debian/patches/01-tune-build-opts.patch b/debian/patches/01-tune-build-opts.patch index e0e24408..2a09b07b 100644 --- a/debian/patches/01-tune-build-opts.patch +++ b/debian/patches/01-tune-build-opts.patch @@ -1,14 +1,15 @@ diff --git a/Makefile b/Makefile -index fe8ae7e..fc8abda 100644 +index 7d04ba0..33ee184 100644 --- a/Makefile +++ b/Makefile -@@ -9,9 +9,9 @@ DEPS := obj/make.dep +@@ -9,10 +9,10 @@ DEPS := obj/make.dep include filelist.mk -USE_AESNI := yes +USE_AESNI := no USE_STATIC := no + USE_MESHNET := no -USE_UPNP := no +USE_UPNP := yes diff --git a/docs/build_notes_windows.md b/docs/build_notes_windows.md index 8ba36131..827d0123 100644 --- a/docs/build_notes_windows.md +++ b/docs/build_notes_windows.md @@ -161,15 +161,17 @@ support for this. Unpack client source code in a sibling folder, e.g. C:\dev\miniupnpc . You may want to remove version number from folder name included in downloaded archive. -Note that you might need to build DLL yourself for 64-bit systems -using msys2 as 64-bit DLLs are not provided by the project. - You can also install it through the MSYS2 and build with USE_UPNP key. ```bash pacman -S mingw-w64-i686-miniupnpc -make USE_UPNP=1 +make USE_UPNP=yes +``` +or +```bash +pacman -S mingw-x86_64-miniupnpc +make USE_UPNP=yes ``` ### Creating Visual Studio project