diff options
-rw-r--r-- | src/network.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network.cpp b/src/network.cpp index fa816bd..4e802f9 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -211,6 +211,13 @@ Peer PeerList::at(size_t i) const void PeerList::onUpdate(function<void(size_t, const Peer *)> w) { + scoped_lock lock(p->dataMutex); + for (size_t i = 0; i < p->peers.size(); i++) { + if (auto speer = p->peers[i]->speer.lock()) { + Peer peer(speer->lpeer); + w(i, &peer); + } + } p->watchers.push_back(w); } |