pinokiod 3.8.109 → 3.8.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/peer.js +2 -2
- package/kernel/router/index.js +11 -8
- package/package.json +1 -1
package/kernel/peer.js
CHANGED
|
@@ -15,7 +15,7 @@ class PeerDiscovery {
|
|
|
15
15
|
stop() {
|
|
16
16
|
if (this.socket) {
|
|
17
17
|
console.log("peer stop")
|
|
18
|
-
clearInterval(this.
|
|
18
|
+
clearInterval(this.interval_handle)
|
|
19
19
|
this.socket.close()
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -58,7 +58,7 @@ class PeerDiscovery {
|
|
|
58
58
|
this.socket.setBroadcast(true);
|
|
59
59
|
|
|
60
60
|
// Send broadcast pings every interval
|
|
61
|
-
this.
|
|
61
|
+
this.interval_handle = setInterval(() => {
|
|
62
62
|
console.log("send message to peers")
|
|
63
63
|
this.socket.send(this.message, 0, this.message.length, this.port, '255.255.255.255');
|
|
64
64
|
}, this.interval);
|
package/kernel/router/index.js
CHANGED
|
@@ -52,16 +52,19 @@ class Router {
|
|
|
52
52
|
console.log("BEFORE REPLACING", mapping)
|
|
53
53
|
|
|
54
54
|
let host_mapping = mapping[this.kernel.peer.host]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
if (host_mapping) {
|
|
56
|
+
let json = JSON.stringify(host_mapping)
|
|
57
|
+
for(let key in this.port_cache) {
|
|
58
|
+
console.log("replacing", key, "with", this.port_cache[key])
|
|
59
|
+
json = json.replaceAll(key, this.port_cache[key])
|
|
60
|
+
}
|
|
61
|
+
console.log("json", json)
|
|
62
|
+
let m = JSON.parse(json)
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
mapping[this.kernel.peer.host] = m
|
|
65
|
+
console.log("AFTER REPLACING", m)
|
|
66
|
+
}
|
|
63
67
|
|
|
64
|
-
console.log("AFTER REPLACING", m)
|
|
65
68
|
return mapping
|
|
66
69
|
|
|
67
70
|
// let json = JSON.stringify(mapping)
|