Skip to content

Commit

Permalink
fix node info broadcast (#128)
Browse files Browse the repository at this point in the history
* install python to wedpr-mpc

* fix node info broadcast
  • Loading branch information
cyjseagull authored Dec 13, 2024
1 parent c5365e7 commit 928602e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 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 @@ -29,9 +29,10 @@ using namespace ppc::gateway;
bool LocalRouter::registerNodeInfo(ppc::protocol::INodeInfo::Ptr nodeInfo,
std::function<void()> onUnHealthHandler, bool removeHandlerOnUnhealth)
{
LOCAL_ROUTER_LOG(DEBUG) << LOG_DESC("registerNodeInfo") << printNodeInfo(nodeInfo);
bool updated = false;
auto ret = m_routerInfo->tryAddNodeInfo(nodeInfo, updated);
LOCAL_ROUTER_LOG(DEBUG) << LOG_DESC("registerNodeInfo") << printNodeInfo(nodeInfo)
<< LOG_KV("updated", updated);
if (ret)
{
// only create the frontClient when update
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
2 changes: 1 addition & 1 deletion docker-files/cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CMD ["--version"]
FROM fiscoorg/wedpr-mpc-base-ubuntu:v3.0.0 as wedpr-mpc-service
LABEL [email protected]

RUN apt-get -q update && apt-get install -qy --no-install-recommends vim libkrb5-dev python3.11 python3-pip python3-dev telnet tcpdump \
RUN apt-get -q update && apt-get install -qy --no-install-recommends vim libkrb5-dev python3.11 python3-pip python3-dev telnet tcpdump net-tools\
&& rm -f /usr/bin/python && ln -s /usr/bin/python3.11 /usr/bin/python \
&& rm -f /usr/bin/python3 && ln -s /usr/bin/python3.11 /usr/bin/python3 \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
Expand Down

0 comments on commit 928602e

Please sign in to comment.