holepunch-hop 0.3.0 → 0.3.1

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/package.json +1 -1
  2. package/src/index.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holepunch-hop",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "data interface to HOP",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -91,10 +91,17 @@ class HolepunchWorker extends EventEmitter {
91
91
  })
92
92
  // peer connection active
93
93
  this.Peers.on('peer-connect', (data) => {
94
+ let taskCheck = 0
95
+ let firstCheck = this.Peers.peerHolder[data]
96
+ if (firstCheck !== undefined) {
97
+ taskCheck = this.Peers.peerHolder[data].data.labels.length
98
+ } else {
99
+ taskCheck = 0
100
+ }
94
101
  // if (this.Peers.peerHolder[data].data.boardID !== undefined) {
95
102
  // any existing peers
96
103
  let holderCheck = Object.keys(this.Peers.peerHolder)
97
- if (holderCheck.length !== 0) {
104
+ if (holderCheck !== 0 && taskCheck === 0) {
98
105
  this.Peers.writeToPublicLibrary(data)
99
106
  } else {
100
107
  this.Peers.writeTonetwork(data)