How to add persistance?

I’m making a peer-to-peer network using go The purpose of this code is just to connect some nodes with each other and exchange some data but when a node get terminated all other nodes will stop working

How to make it persistent so even if a node closes other nodes will keep working?

Hi @thecow_milk, I am not familiar with libp2p, and from looking at the code I cannot tell what it does, or where the problem is.


  • How exactly do the other nodes stop working when one node terminates? Do you get an error? Do they terminate silently? (I doubt that the latter happens, as the select{} at the end of main() should make the binary run forever if no error occurs.)
  • what libs are used here? (I see e.g. a package named host but no import)
  • What do writeData() and readData() do? (Not included in the code snippet)
  • Did you review the package doc of the packages you use, to see if they describe the behavior of nodes if one node stops sending data?
  • How does the first node get terminated? Could that mechanism also take the other nodes down by chance?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.