OverviewFilesCommitsIssuesDocsReleasesPeers

pear-git commits / 94eb90f

Add connection logging to MetadataBase swarm
Debug: log when peers connect on the MetadataBase's own Hyperswarm and which discovery key is joined. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
94eb90faf5577442f29aa669b8de08797af80619
by plankatron <fleeky@gmail.com> · 2026-04-05T13:22:01.000Z

Changed files (1) +3 -0

lib/metadata-base.js +3 -0
……@@ -83,10 +83,13 @@ export class MetadataBase {
8383 // Own Hyperswarm — joins discovery key, handles connections
8484 this.swarm = new Hyperswarm(this._swarmOpts)
8585 this.swarm.on('connection', (socket) => {
86 const peerKey = socket.remotePublicKey?.toString('hex')?.slice(0, 8) || 'unknown'
87 console.log(`[Metadata] Swarm connection from ${peerKey}`)
8688 this.store.replicate(socket)
8789 this._exchangeWriters(socket)
8890 })
8991 this.swarm.join(this._base.discoveryKey)
92 console.log(`[Metadata] Swarm joined discovery key: ${this._base.discoveryKey.toString('hex').slice(0, 16)}`)
9093
9194 this._ready = true
9295 }