diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp index 96d2d094..7bd332e3 100644 --- a/libi2pd/Destination.cpp +++ b/libi2pd/Destination.cpp @@ -1447,9 +1447,12 @@ namespace client { std::vector > ret; if (m_StreamingDestination) - m_StreamingDestination->GetStreamsList (ret); + ret = m_StreamingDestination->GetStreamsList (); for (auto& it: m_StreamingDestinationsByPorts) - it.second->GetStreamsList (ret); + { + auto streams = it.second->GetStreamsList (); + ret.insert (ret.end (), streams.begin (), streams.end ()); + } return ret; } diff --git a/libi2pd/Streaming.h b/libi2pd/Streaming.h index 4b4e8fea..ccb683b2 100644 --- a/libi2pd/Streaming.h +++ b/libi2pd/Streaming.h @@ -394,11 +394,14 @@ namespace stream const decltype(m_Streams)& GetStreams () const { return m_Streams; }; // copy for other threads, unlike GetStreams which hands out the map itself - void GetStreamsList (std::vector >& streams) + std::vector > GetStreamsList () { std::unique_lock l(m_StreamsMutex); + std::vector > streams; + streams.reserve (m_Streams.size ()); for (const auto& it: m_Streams) streams.push_back (it.second); + return streams; } };