* swarm/network: Kademlia updates to full and SuggestPeer methods
* swarm/network: add more tests and fixes
* fixed a bug in state store that did not close the file handle on shutdown
* added test for kademlia state storage across sessions
- memstore garbage collect does not delete open requests
- dbstore batch write errors handling somewhat impoved but should be checkable after dbStored fires
- inproc adapter does not allow message events in p2p server
- network pkg allows loglevel flag
- streamer registry gets a defaultSkipCheck option which the RequestFromPeers uses
- waitForPeers gets a parameter how many peers it should wait for
- number of peers to wait for is given by the global peerCount NodeID -> int function
- make delivery and received chunk channels buffered with const deliveryCap
- change all sendpriority calls to use context to avoid disconnects due to buffer contention (but potential memory leak!)
- check error for all sends
- abstract out trigger function for pivot
- abstract out client calls for IDs
- introduce channel to control check function is only called if previous one finished even if triggered (dubious)
- implement benchmarks for delivery through a chain of requests through multiple hops
- abstract out batchDone function on client
- rename peer locks to client/serverMu
- testing CheckResult only gives averages if there are more than one node to passed
- testing implememts WatchDisconnections which aborts the simulation
- testing implements PivorTrigger and ClientCall
p2p/simulations: introduce dialBan
- Refactor simulations/network connection getters to support
avoiding simultaneous dials between two peers If two peers dial
simultaneously, the connection will be dropped to help avoid
that, we essentially lock the connection object with a
timestamp which serves as a ban on dialing for a period of time
(dialBanTimeout).
- The connection getter InitConn can be wrapped and passed to the
nodes via adapters.NodeConfig#Reachable field and then used by
the respective services when they initiate connections. This
massively stablise the emerging connectivity when running with
hundreds of nodes bootstrapping a network.
p2p: add Inbound public method to p2p.Peer
p2p/simulations: Add server id to logs to support debugging
in-memory network simulations when multiple peers are logging.
p2p: SetupConn now returns error. The dialer checks the error and
only calls resolve if the actual TCP dial fails.
This commit introduces a network simulation framework which
can be used to run simulated networks of devp2p nodes. The
intention is to use this for testing protocols, performing
benchmarks and visualising emergent network behaviour.