diff options
Diffstat (limited to 'src/network.cpp')
-rw-r--r-- | src/network.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/network.cpp b/src/network.cpp index 74783b4..f33c097 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -201,8 +201,9 @@ void PeerList::onUpdate(function<void(size_t, const Peer *)> w) Server::Priv::Priv(const Head<LocalState> & local, const Identity & self, vector<unique_ptr<Service>> && svcs): - localHead(local), self(self), + // Watching needs to start after self is initialized + localHead(local.watch(std::bind(&Priv::handleLocalHeadChange, this, std::placeholders::_1))), services(std::move(svcs)) { struct ifaddrs * raddrs; @@ -238,8 +239,6 @@ Server::Priv::Priv(const Head<LocalState> & local, const Identity & self, threadListen = thread([this] { doListen(); }); threadAnnounce = thread([this] { doAnnounce(); }); - - local.watch(std::bind(&Priv::handleLocalHeadChange, this, std::placeholders::_1)); } Server::Priv::~Priv() |