Skip to content

Commit 21455c3

Browse files
committed
Correctly propagate file sources between hubs
1 parent 2f5f84d commit 21455c3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

agent/mesh.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ export default function (rootDir, listen, config, onConfigUpdate) {
933933
hubActive.forEach(h => h.leave())
934934
searchHub().then(hub => {
935935
hubActive[0] = Hub(hub.id, hub.zone, hub.port)
936+
advertiseFilesystem()
936937
new Timeout(1).wait().then(monitorHub)
937938
})
938939
} else {
@@ -1295,6 +1296,7 @@ export default function (rootDir, listen, config, onConfigUpdate) {
12951296
var port = hub.ports.reduce((a, b) => a.ping < b ? a : b)
12961297
hubActive.forEach(h => h.leave())
12971298
hubActive[0] = Hub(hub.id, hub.zone, port.name)
1299+
advertiseFilesystem()
12981300
}
12991301
}
13001302
)

hub/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ function start(listen, bootstrap) {
408408
get: {
409409
endpoints: (id, name, user, keyword, limit, offset) => listEndpoints(id, name, user, keyword, limit, offset),
410410
files: () => dumpFileSystem(),
411+
fileSources: (path) => dumpFileSources(path),
411412
acl: () => dumpACL(),
412413
evictions: () => evictions,
413414
},
@@ -1544,6 +1545,15 @@ function dumpFileSystem() {
15441545
return all
15451546
}
15461547

1548+
function dumpFileSources(path) {
1549+
var f = files[path]
1550+
if (f) {
1551+
return [...f['@']]
1552+
} else {
1553+
return []
1554+
}
1555+
}
1556+
15471557
function makeFileInfo(hash, size, time, since) {
15481558
return {
15491559
'#': hash,

0 commit comments

Comments
 (0)