OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-svc commits / 2664208

swarm transport: don't assume a single .base on mounts
_onConnection read `instance.base` for every mount and called base.replicate(conn). A multi-autobase mount (per-org HyperOrgs) has no single base — its getter THROWS on >1 — which aborted the daemon (SIGABRT) on the first incoming connection once a 2nd org existed. Prefer an optional `instance.replicate(conn)` (the consumer replicates its own autobase(s)), fall back to `.base.replicate`, and wrap the whole access so a throwing getter can never crash the daemon. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2664208039a1348a6ed6b27976f3ee18915d07fa
by plankatron <fleeky@gmail.com> · 2026-05-26T00:02:25.000Z

Changed files (1) +15 -7

lib/transports/swarm.js +15 -7
……@@ -100,14 +100,22 @@ export class SwarmTransport {
100100 for (const { name, instance } of this._getMounts()) {
101101 if (!instance) continue
102102
103 const base = instance.base
104 if (base && typeof base.replicate === 'function') {
105 try {
106 base.replicate(conn)
107 } catch (err) {
108 // eslint-disable-next-line no-console
109 console.error(`[hyper-svc/swarm] ${name}.base.replicate failed:`, err.message)
103 // A mount may expose `replicate(conn)` to replicate its own
104 // autobase(s) — required for MULTI-autobase mounts (e.g. per-org
105 // HyperOrgs) whose single `.base` getter is undefined or THROWS.
106 // Otherwise fall back to the single-autobase `.base.replicate`.
107 // The whole access is wrapped: a throwing `.base` getter must
108 // never abort the daemon on an incoming connection.
109 try {
110 if (typeof instance.replicate === 'function') {
111 instance.replicate(conn)
112 } else {
113 const base = instance.base
114 if (base && typeof base.replicate === 'function') base.replicate(conn)
110115 }
116 } catch (err) {
117 // eslint-disable-next-line no-console
118 console.error(`[hyper-svc/swarm] ${name} replicate failed:`, err.message)
111119 }
112120
113121 if (typeof instance.attachProtocol === 'function') {