From 9637cefdebe3e1425034a5c3e7ba9137d564e6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 4 Dec 2022 19:46:45 +0100 Subject: Pass existing peer info when registering peer list watcher --- src/network.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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 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); } -- cgit v1.2.3