Skip to content

Commit

Permalink
sync from main
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Dec 13, 2024
2 parents 9685be9 + c5365e7 commit aea6729
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions cpp/wedpr-protocol/protobuf/src/NodeInfoImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void NodeInfoImpl::encode(bcos::bytes& data) const
void NodeInfoImpl::encodeFields() const
{
bcos::ReadGuard l(x_components);
m_rawNodeInfo->clear_components();
// set the components
for (auto const& component : m_components)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ bool GatewayNodeInfoImpl::tryAddNodeInfo(INodeInfo::Ptr const& info, bool& updat
GATEWAY_LOG(INFO) << LOG_DESC("tryAddNodeInfo, update the components, updated nodeInfo")
<< printNodeInfo(existedNodeInfo);
}
// the existed node re-encode
if (updated)
{
auto nodeInfo = std::dynamic_pointer_cast<NodeInfoImpl>(existedNodeInfo);
nodeInfo->encodeFields();
}
return false;
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool LocalRouter::registerNodeInfo(ppc::protocol::INodeInfo::Ptr nodeInfo,
std::function<void()> onUnHealthHandler, bool removeHandlerOnUnhealth)
{
bool updated = false;
auto ret = m_routerInfo->tryAddNodeInfo(nodeInfo, &updated);
auto ret = m_routerInfo->tryAddNodeInfo(nodeInfo, updated);
LOCAL_ROUTER_LOG(DEBUG) << LOG_DESC("registerNodeInfo") << printNodeInfo(nodeInfo)
<< LOG_KV("updated", updated);
if (ret)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void registerNode(GatewayNodeInfoImpl::Ptr gatewayNodeInfo, int nodeSize)
auto populatedNodeID = nodeID + std::to_string(i);
auto nodeInfo = fakeNodeInfo(nodeInfoFactory, populatedNodeID, endPoint, components);
testNodeInfoEncodeDecode(nodeInfoFactory, nodeInfo);
gatewayNodeInfo->tryAddNodeInfo(nodeInfo);
bool updated = false;
gatewayNodeInfo->tryAddNodeInfo(nodeInfo, updated);
}
}

Expand Down

0 comments on commit aea6729

Please sign in to comment.