(msg: RpcMessage)
| 82 | } |
| 83 | |
| 84 | recvRpcMessage(msg: RpcMessage) { |
| 85 | dlog("router received message", msg); |
| 86 | // we are a terminal node by definition, so we don't need to process with announce/unannounce messages |
| 87 | if (msg.command == "routeannounce" || msg.command == "routeunannounce") { |
| 88 | return; |
| 89 | } |
| 90 | // handle events |
| 91 | if (msg.command == "eventrecv") { |
| 92 | handleWaveEvent(msg.data); |
| 93 | return; |
| 94 | } |
| 95 | if (!util.isBlank(msg.command)) { |
| 96 | // send + register routeinfo |
| 97 | if (!util.isBlank(msg.reqid)) { |
| 98 | this._registerRouteInfo(msg.reqid, msg.source, msg.route); |
| 99 | } |
| 100 | this._sendRoutedMessage(msg, msg.route); |
| 101 | return; |
| 102 | } |
| 103 | if (!util.isBlank(msg.reqid)) { |
| 104 | const routeInfo = this.rpcMap.get(msg.reqid); |
| 105 | if (!routeInfo) { |
| 106 | // no route info, discard |
| 107 | dlog("no route info for reqid, discarding", msg); |
| 108 | return; |
| 109 | } |
| 110 | this._sendRoutedMessage(msg, routeInfo.destRouteId); |
| 111 | return; |
| 112 | } |
| 113 | if (!util.isBlank(msg.resid)) { |
| 114 | const routeInfo = this.rpcMap.get(msg.resid); |
| 115 | if (!routeInfo) { |
| 116 | // no route info, discard |
| 117 | dlog("no route info for resid, discarding", msg); |
| 118 | return; |
| 119 | } |
| 120 | this._sendRoutedMessage(msg, routeInfo.sourceRouteId); |
| 121 | if (!msg.cont) { |
| 122 | dlog("deleting route info", msg.resid); |
| 123 | this.rpcMap.delete(msg.resid); |
| 124 | } |
| 125 | return; |
| 126 | } |
| 127 | dlog("bad rpc message recevied by router, no command, reqid, or resid (discarding)", msg); |
| 128 | } |
| 129 | |
| 130 | registerRoute(routeId: string, client: AbstractWshClient) { |
| 131 | if (routeId == SysRouteName) { |
nothing calls this directly
no test coverage detected