| … | … | @@ -83,10 +83,13 @@ export class MetadataBase { |
| 83 | 83 | // Own Hyperswarm — joins discovery key, handles connections |
| 84 | 84 | this.swarm = new Hyperswarm(this._swarmOpts) |
| 85 | 85 | this.swarm.on('connection', (socket) => { |
| 86 | const peerKey = socket.remotePublicKey?.toString('hex')?.slice(0, 8) || 'unknown' | |
| 87 | console.log(`[Metadata] Swarm connection from ${peerKey}`) | |
| 86 | 88 | this.store.replicate(socket) |
| 87 | 89 | this._exchangeWriters(socket) |
| 88 | 90 | }) |
| 89 | 91 | this.swarm.join(this._base.discoveryKey) |
| 92 | console.log(`[Metadata] Swarm joined discovery key: ${this._base.discoveryKey.toString('hex').slice(0, 16)}`) | |
| 90 | 93 | |
| 91 | 94 | this._ready = true |
| 92 | 95 | } |