Neptune-Crypto / neptune-core

anonymous peer-to-peer cash
Apache License 2.0
27 stars 8 forks source link

Wrap all peer-loop execution in `catch_unwind` #13

Closed Sword-Smith closed 1 year ago

Sword-Smith commented 1 year ago

This should ensure that the peer map is always up-to-date even if a peer-loop panics, which shouldn't be possible.

ps1dr3x commented 1 year ago

Are you aware of specific non unwind safe cases in the code?

I probably wouldn't have been so cautious to do it otherwise, but the code looks good to me and I don't think it would cause any harm, so why not (especially since it's done already 😄).

Sword-Smith commented 1 year ago

Are you aware of specific non unwind safe cases in the code?

I actually can't answer that as I don't really know what it means :/

I was just thinking that I wanted to provide a callback function in case the peer_loop thread panicked. Such that the part of the global state that keeps track of connected peers can be correctly updated.