Commit Graph

20 Commits

Author SHA1 Message Date
Adrià Cidre 893b464597
Pre-cache more peers than those defined on max limit (#989)
Peers between maxPeers and maxCachedPeers added as server Peers instead of queued peers
2018-06-06 15:39:27 +02:00
Adam Babik 717d0fbadb
Fix another round of flaky tests (#996) 2018-05-29 13:24:23 +02:00
Adam Babik b5f05b1ab5
Fix flaky TestSingleTopicDiscoveryWithFailover and others (#992)
Other changes:
* needed to patch that loop implementation in Discover V5 implementation in go-ethereum,
* fixed TestStatusNodeReconnectStaticPeers,
* fixed TestBackendAccountsConcurrently.
2018-05-26 09:37:13 +02:00
Dmitry Shulyak 345b152a8b
Heap queue stores only peers that were not added to p2p server (#979)
* Heap queue stores only peers that were not added to p2p server

The primary goal of this change is to keep whitelist of peers
that are managed by topic pool while also preventing same peer
from being selected from heap queue multiple times.
2018-05-22 16:11:21 +03:00
Adrià Cidre ace175ba69 Fix flaky test TestPeerPoolSimulationSuite/TestSingleTopicDiscoveryWithFailover 2018-05-22 12:34:32 +03:00
Dmitry Shulyak f5a8be08de
Use cache in topic pool (#955)
It must have slipped when i moved significant chunk of logic
from peer pool to topic pool and because of the != nil protection
this bug was missed
2018-05-15 18:05:57 +03:00
Dmitry Shulyak 9e65b5a6ae Dump peer infos as discovery summary 2018-05-15 13:11:28 +03:00
Adam Babik 9268f55d7d
Prevent Discovery from timeout when registering topics (#944)
When the node registers topics, Discovery V5 should never be stopped as otherwise, no peer will be able to find the node.
2018-05-15 11:16:25 +02:00
Dmitry Shulyak 938113882a
Add cluster for ropsten/mainnet (#929) 2018-05-14 08:24:49 +03:00
Dmitry Shulyak 375d5ec8c3
Explicitly disable discovery (#886)
* Make it possible to explicitly disable discovery

Discovery will be disabled in following cases:
- if there are not bootnodes - v5 server will be disabled
because there is no point in running it
- if user defined in config NoDiscovery=true this value will be preserved
even if we have bootnodes

So, basically discovery will be always enabled by default on mobile, unless
it is explicitly specified otherwise.

When statusd is used current behavior is that discovery is disabled by default.
I kept it in this change, but it would be better to change it.

* Fix leftovers

* Add wait group to peer pool to protect from races with p2p.Server

* Change fields only when all goroutines finished

* Turn off discovery after topic searches are stopped

* Don't set period to nil to avoid race with SearchTopic

* Close period chan only when all writers are finished
2018-05-10 14:45:51 +03:00
Ivan Danyliuk 953c26e8cf
Move signal logic into signal package 2018-05-03 09:35:58 +02:00
Adam Babik 809c5a4db2
Limit time spent in fast mode and timeout Discovery V5 (#867) 2018-05-01 17:19:11 +02:00
Igor Mandrigin f4cd8d27b5 Add `shhext_getNewFilterMessages` function to RPC APIs.
This function returns only the new messages from the filter, never
returns the same message for the same user twice.
2018-04-27 15:24:37 +02:00
Dmitry Shulyak f3e2631c1d
Add signals for notifying react about discovery activity (#859)
* Add signal for notifying react on discovery activity

* Whitelist expected signals in e2e tests
2018-04-25 10:13:59 +03:00
Ivan Danyliuk 56292fb505 Make Limits type a struct 2018-04-21 00:03:40 +02:00
Adam Babik a45b05969a
Add a priority queue to TopicPool (#840) 2018-04-19 17:18:49 +02:00
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