提交 ac05ab42 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 1455e1eb
......@@ -99,7 +99,6 @@ private:
pid_t pid;
for(auto &[k,v]:data.items()) {
if(k == this->devSn) {
// startup evmgr
peerId = v["sn"].get<string>() + ":evmgr:0";
this->peerData["config"][peerId] = v;
if(this->peerData["status"].count(peerId) == 0) {
......@@ -107,6 +106,7 @@ private:
}else{
// nop
}
this->peerData["enabled"][peerId] = 1;
}
// startup other submodules
......@@ -313,7 +313,7 @@ private:
this->peerData["status"][selfId] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
// msg to peer
string myId = devSn + ":0:0";
string myId = devSn + ":evmgr:0";
int minLen = std::min(body[1].size(), myId.size());
if(memcmp((void*)(body[1].data()), myId.data(), minLen) != 0) {
// message to other peer
......
......@@ -176,7 +176,7 @@ private:
this->peerData["status"][selfId] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
// msg to peer
string myId = devSn + ":0:0";
string myId = devSn + ":evmgr:0";
int minLen = std::min(body[1].size(), myId.size());
if(memcmp((void*)(body[1].data()), myId.data(), minLen) != 0) {
// message to other peer
......
......@@ -235,7 +235,7 @@ private:
int ret = 0;
vector<vector<uint8_t> >body;
// since identity is auto set
body.push_back(str2body(mgrSn+":0:0"));
body.push_back(str2body(mgrSn+":evmgr:0"));
body.push_back(str2body(EV_MSG_META_PING)); // blank meta
body.push_back(str2body(MSG_HELLO));
......
......@@ -132,7 +132,7 @@ private:
int ping()
{
int ret = 0;
vector<vector<uint8_t> >body = {str2body(mgrSn + ":0:0"), str2body(EV_MSG_META_PING), str2body(MSG_HELLO)};
vector<vector<uint8_t> >body = {str2body(mgrSn + ":evmgr:0"), str2body(EV_MSG_META_PING), str2body(MSG_HELLO)};
ret = z_send_multiple(pDealer, body);
if(ret < 0) {
......
......@@ -146,7 +146,7 @@ private:
{
// send hello to router
int ret = 0;
vector<vector<uint8_t> >body = {str2body(mgrSn+":0:0"), str2body(EV_MSG_META_PING),str2body(MSG_HELLO)};
vector<vector<uint8_t> >body = {str2body(mgrSn+":evmgr:0"), str2body(EV_MSG_META_PING),str2body(MSG_HELLO)};
ret = z_send_multiple(pDealer, body);
if(ret < 0) {
spdlog::error("evpusher {} {} failed to send multiple: {}", devSn, iid, zmq_strerror(zmq_errno()));
......
......@@ -209,7 +209,7 @@ private:
// send hello to router
int ret = 0;
/// identity is auto set
vector<vector<uint8_t> >body = {str2body(mgrSn+":0:0"), str2body(EV_MSG_META_PING), str2body(MSG_HELLO)};
vector<vector<uint8_t> >body = {str2body(mgrSn+":evmgr:0"), str2body(EV_MSG_META_PING), str2body(MSG_HELLO)};
ret = z_send_multiple(pDealer, body);
if(ret < 0) {
spdlog::error("evslicer {} failed to send multiple: {}", selfId, zmq_strerror(zmq_errno()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论