Commit Graph

4 Commits

Author SHA1 Message Date
Dmitry Shulyak fa526e7444 Prevent potential call on discv5 which became nil
It could happen when we found multiple relevant peers and they were
processed before discv5 closed. For example we have max limit of 1:
- found peer A and B in the same kademlia cycle
- process peer A
- max limit is reached -> closed discv5 and set it to nil
- process peer B
- panic!!!
2018-04-19 16:01:48 +03:00
Dmitry Shulyak 5014e4e3b0
Fix two race conditions in peerpool tests (#827)
Multiple concurrent topic pool stops could result in the close of the closed
quit channel. Fixed by using atomic compare and swap and closing only if swap
happened.

Added events feed to peer pool for tests purpose. Otherwise it is impossible to run
simulation with -race flag enabled. In the essence it happens because we are managing global
object , which is server.Discv5, but unfortunately there is no way around it.
2018-04-13 11:34:30 +03:00
Dmitry Shulyak a7a2e01b4a
Peerpool failover (#801) 2018-04-12 16:08:49 +03:00
Dmitry Shulyak 02309e81e9
Peer pool to manage v5 peers (#736) 2018-04-10 09:44:09 +03:00