fix: fix bugs in event mechanism

fix bugs in event delivering cross nodes
This commit is contained in:
Frank.R.Wu 2021-11-26 15:54:34 +08:00
parent 3ab558bf10
commit b0e87f8f0a
3 changed files with 6 additions and 6 deletions

View File

@ -37,8 +37,8 @@ public class CMNode {
}
}
public void sendEMsg(String msg) {
connection.controller.sendEMsg(msg);
public void sendEvent(String msg) {
connection.controller.sendEvent(msg);
}
public String formatContractName(String contractIDOrName) {

View File

@ -668,7 +668,7 @@ public class NodeCenterActions {
}
@Action(async = true)
public void deliverEMessage(JsonObject json, ResultCallback cb) {
public void deliverEvent(JsonObject json, ResultCallback cb) {
if (cb instanceof HttpResultCallback) {
Response r = new Response();
r.action = "deliverEvent";
@ -678,7 +678,7 @@ public class NodeCenterActions {
}
CMNode node = nodeInfos.get(json.get("target").getAsString());
node.sendEMsg(json.get("msg").getAsString());
node.sendEvent(json.get("msg").getAsString());
}
@Action

View File

@ -146,9 +146,9 @@ public class NodeCenterFrameHandler extends SimpleChannelInboundHandler<Object>
}
}
public void sendEMsg(String msg) {
public void sendEvent(String msg) {
Response r = new Response();
r.action = "receiveEMsg";
r.action = "deliverEvent";
r.data = msg;
sendMsg(JsonUtil.toJson(r));
}