File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,14 @@ namespace libp2p::network {
2323 if (it == connections_.end ()) {
2424 return {};
2525 }
26-
27- return std::vector<ConnectionManager::ConnectionSPtr>(it->second .begin (),
28- it->second .end ());
26+ std::vector<ConnectionSPtr> out;
27+ out.reserve (it->second .size ());
28+ for (const auto &conn : it->second ) {
29+ if (not conn->isClosed ()) {
30+ out.emplace_back (conn);
31+ }
32+ }
33+ return out;
2934 }
3035
3136 ConnectionManager::ConnectionSPtr
@@ -66,7 +71,11 @@ namespace libp2p::network {
6671 out.reserve (connections_.size ());
6772
6873 for (auto &&entry : connections_) {
69- out.insert (out.end (), entry.second .begin (), entry.second .end ());
74+ for (const auto &conn : entry.second ) {
75+ if (not conn->isClosed ()) {
76+ out.emplace_back (conn);
77+ }
78+ }
7079 }
7180
7281 return out;
You can’t perform that action at this time.
0 commit comments