Skip to content

Commit

Permalink
small unability fix
Browse files Browse the repository at this point in the history
  • Loading branch information
micahcc committed Jan 21, 2021
1 parent 95026da commit fa7faab
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/TopologyManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ TopologyManager::TopologyManager(std::string_view announcePath, std::string_view
oss << '\0' << std::hex << std::setw(16) << std::setfill('0') << mNodeId;
mAddress = oss.str();

TopologyMessage msg;
auto nodeMsg = msg.mutable_node_changes()->Add();
nodeMsg->set_id(mNodeId);
nodeMsg->set_op(NodeOperation::JOIN);
nodeMsg->set_name(mName);
nodeMsg->set_address(oss.str());
mStore->ApplyUpdate(msg);

mMainThread = std::thread([this]() { MainLoop(); });
}

Expand Down Expand Up @@ -102,6 +94,18 @@ void TopologyManager::MainLoop() {
}
};

{
// send update about ourself
TopologyMessage msg;
auto nodeMsg = msg.mutable_node_changes()->Add();
nodeMsg->set_id(mNodeId);
nodeMsg->set_op(NodeOperation::JOIN);
nodeMsg->set_name(mName);
nodeMsg->set_address(mAddress);
mStore->ApplyUpdate(msg);
mOnJoin(*nodeMsg);
}

while (!mShutdown) {
mClient = UDSClient::Create(mAnnouncePath, onMessage);
if (mClient != nullptr) {
Expand Down

0 comments on commit fa7faab

Please sign in to comment.