status-im / nim-eth-p2p

Nim Ethereum P2P protocol implementation
Apache License 2.0
11 stars 4 forks source link

Improve exception-safety #62

Open arnetheduck opened 5 years ago

arnetheduck commented 5 years ago

In code like the following, an exception will upset the logic and cause further damage down the road that may be hard to understand / open up for security issues:

https://github.com/status-im/nim-eth-p2p/blob/53e98faa74ce3f9e690fc985e56d18cf76b67b42/eth_p2p/peer_pool.nim#L110

An exception in onPeerConnected means other observers won't be notified. I'm listing one instance here as an example, but the code is riddled with similar issue.