pinokiod 3.8.94 → 3.8.95
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/bin/caddy.js +5 -5
- package/kernel/index.js +28 -16
- package/package.json +1 -1
- package/server/index.js +2 -0
package/kernel/bin/caddy.js
CHANGED
|
@@ -20,11 +20,11 @@ class Caddy {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
async start() {
|
|
23
|
-
let running = await this.running()
|
|
24
|
-
console.log("Running", running)
|
|
25
|
-
if (running) {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
23
|
+
// let running = await this.running()
|
|
24
|
+
// console.log("Running", running)
|
|
25
|
+
// if (running) {
|
|
26
|
+
// return
|
|
27
|
+
// }
|
|
28
28
|
let installed = await this.installed()
|
|
29
29
|
console.log("Caddy Installed?", installed)
|
|
30
30
|
if (installed) {
|
package/kernel/index.js
CHANGED
|
@@ -260,22 +260,34 @@ class Kernel {
|
|
|
260
260
|
this.log_queue.push({ data, group, info })
|
|
261
261
|
}
|
|
262
262
|
async refresh(notify_peers) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
263
|
+
let env = await Environment.get(this.homedir)
|
|
264
|
+
let active = false
|
|
265
|
+
// if PINOKIO_NETWORK_SHARE is 0 or false, turn it off
|
|
266
|
+
if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="1" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="true")) {
|
|
267
|
+
active = true
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
console.log("kernel.refresh", { active, notify_peers })
|
|
271
|
+
if (active) {
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
await Promise.all([
|
|
275
|
+
// refresh proc info
|
|
276
|
+
this.processes.refresh(),
|
|
277
|
+
// refresh peer info
|
|
278
|
+
this.peer.refresh()
|
|
279
|
+
])
|
|
280
|
+
console.log("proc info", this.processes.info)
|
|
281
|
+
console.log("peer info", this.peer.info)
|
|
282
|
+
// refresh router info
|
|
283
|
+
await this.router.refresh()
|
|
284
|
+
console.log("router info", this.router.published())
|
|
285
|
+
await this.peer.refresh()
|
|
286
|
+
|
|
287
|
+
if (notify_peers) {
|
|
288
|
+
// broadcast to peers to refresh
|
|
289
|
+
await this.peer.notify_peers()
|
|
290
|
+
}
|
|
279
291
|
}
|
|
280
292
|
}
|
|
281
293
|
async clearLog(group) {
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -3875,6 +3875,7 @@ class Server {
|
|
|
3875
3875
|
if (this.kernel.peer.active) {
|
|
3876
3876
|
// if network is active, return success only if the router is up for all of its peers (including itself)
|
|
3877
3877
|
console.log({ peer_info: this.kernel.peer.info })
|
|
3878
|
+
console.time("check_peer")
|
|
3878
3879
|
let ready = true
|
|
3879
3880
|
if (this.kernel.peer.info) {
|
|
3880
3881
|
for(let host in this.kernel.peer.info) {
|
|
@@ -3890,6 +3891,7 @@ class Server {
|
|
|
3890
3891
|
ready = false;
|
|
3891
3892
|
}
|
|
3892
3893
|
console.log({ info: this.kernel.peer.info, ready })
|
|
3894
|
+
console.timeEnd("check_peer")
|
|
3893
3895
|
if (ready) {
|
|
3894
3896
|
res.json({ success: true })
|
|
3895
3897
|
} else {
|