kappa-db / multifeed

Multi-writer hypercore.
135 stars 27 forks source link

Live replication does not forward new feeds #27

Closed telamon closed 5 years ago

telamon commented 5 years ago

I stumbled upon this by accident while repairing the encryption, turns out that even though our feeds support live-replication (announcement of new feed-entries), multifeed itself never announced new feeds to existing connections. (The feed exchange happens only once during initial handshake)

Currently you have to drop the connection to an active peer and reconnect in order for new feeds-lists to be properly re-exchanged.

A quick solution would be to have a list with references to all currently connected peers. And whenever a multifeed.feed(...) event is emitted then send an mux#have event on each connected peer-socket. This will re-start the feed-exchange on both ends and new feeds should successfully be forwarded throughout the swarm.

For safety reasons, we should also throttle received "have" events to avoid letting remote peers exploit this feature.