pinokiod 3.8.111 → 3.8.113

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.
Files changed (2) hide show
  1. package/kernel/peer.js +7 -1
  2. package/package.json +1 -1
package/kernel/peer.js CHANGED
@@ -10,6 +10,7 @@ class PeerDiscovery {
10
10
  this.peers = new Set();
11
11
  this.host = this._getLocalIPAddress()
12
12
  this.default_port = 42000
13
+ this.socket = dgram.createSocket('udp4');
13
14
  // this.start();
14
15
  }
15
16
  stop() {
@@ -37,7 +38,7 @@ class PeerDiscovery {
37
38
  if (this.active) {
38
39
  // Listen for incoming pings
39
40
  console.log("kernel.peer start")
40
- this.socket = dgram.createSocket('udp4');
41
+ // this.socket = dgram.createSocket('udp4');
41
42
  this.socket.on('message', (msg, rinfo) => {
42
43
  console.log("peer message", { msg, rinfo })
43
44
  const ip = rinfo.address;
@@ -50,11 +51,16 @@ class PeerDiscovery {
50
51
  }
51
52
  }
52
53
  });
54
+ this.socket.on('error', (err) => {
55
+ console.error('UDP error', err);
56
+ });
53
57
 
54
58
  // Enable broadcast
55
59
  console.log("binding socket")
56
60
  this.socket.bind({ address: "0.0.0.0", port: this.port }, () => {
57
61
  console.log("socket bound")
62
+ this.socket.setMulticastLoopback(true);
63
+
58
64
  this.socket.setBroadcast(true);
59
65
 
60
66
  // Send broadcast pings every interval
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.111",
3
+ "version": "3.8.113",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {