Felix Lange
2adcc31bb4
p2p/discover: new distance metric based on sha3(id)
...
The previous metric was pubkey1^pubkey2, as specified in the Kademlia
paper. We missed that EC public keys are not uniformly distributed.
Using the hash of the public keys addresses that. It also makes it
a bit harder to generate node IDs that are close to a particular node.
10 years ago
Péter Szilágyi
4accc187d5
eth, p2p: add trusted node list beside static list
10 years ago
Péter Szilágyi
54db54931e
p2p: add static node dialing test
10 years ago
Péter Szilágyi
e82ddd9198
p2p: correct a leftover trusted -> static
10 years ago
Péter Szilágyi
413ace37d3
eth, p2p: rename trusted nodes to static, drop inbound extra slots
10 years ago
Péter Szilágyi
701591b403
cmd, eth, p2p: fix review issues enumerated by Felix
10 years ago
Péter Szilágyi
1528dbc171
p2p: add trust check to handshake, test privileged connectivity
...
Conflicts:
p2p/server_test.go
10 years ago
Péter Szilágyi
14f32a0c3a
p2p: reduce the severity of a debug log
10 years ago
Péter Szilágyi
de0549fabb
cmd/geth, cmd/mist, cmd/utils, eth, p2p: support trusted peers
10 years ago
Felix Lange
72ab6d3255
p2p/discover: track sha3(ID) in Node
10 years ago
Felix Lange
b34a8ef624
p2p, p2p/discover: protocol version 4
10 years ago
Felix Lange
fc747ef4a6
p2p/discover: new endpoint format
...
This commit changes the discovery protocol to use the new "v4" endpoint
format, which allows for separate UDP and TCP ports and makes it
possible to discover the UDP address after NAT.
10 years ago
obscuren
01e3d694a6
p2p: added received at to peer message
...
p2p.Msg.ReceivedAt can be used for determining block propagation from
begining to end.
10 years ago
Péter Szilágyi
b569550a39
p2p/discover: fix api issues caused by leveldb update
10 years ago
Péter Szilágyi
4992765032
p2p/discover: fix goroutine leak due to blocking on sync.Once
10 years ago
Péter Szilágyi
437cf4b3ac
p2p/discover: add node expirer and related tests
10 years ago
Péter Szilágyi
a136e2bb22
p2p/discover: parametrize nodedb version, add persistency tests
10 years ago
Péter Szilágyi
75fd738dea
p2p/discover: drop a superfluous warning
10 years ago
Péter Szilágyi
706da56f75
p2p/discover: wrap the pinger to update the node db too
10 years ago
Péter Szilágyi
85b4b44235
p2p/discover: use iterator based seeding, drop old protocol test
10 years ago
Péter Szilágyi
8de8f61d36
p2p/discover: write the basic tests, catch RLP bug
10 years ago
Péter Szilágyi
0201c04b95
p2p/discovery: fix issues raised in the nodeDb PR
10 years ago
Péter Szilágyi
8646365b42
cmd/bootnode, eth, p2p, p2p/discover: use a fancier db design
10 years ago
Péter Szilágyi
6def110c37
cmd/bootnode, eth, p2p, p2p/discover: clean up the seeder and mesh into eth.
10 years ago
Péter Szilágyi
971702e7a1
p2p/discovery: fix broken tests due to API update
10 years ago
Péter Szilágyi
af923c965f
p2p/discovery: use the seed table for finding nodes, auto drop stale ones
10 years ago
Péter Szilágyi
5f735d6fce
cmd, eth, p2p, p2p/discover: init and clean up the seed cache
10 years ago
Felix Lange
936c8e19ff
p2p/discover: store nodes in leveldb
10 years ago
Felix Lange
635b66acdc
p2p: return zero node from Self if the server is not running
...
This helps with fixing the tests for cmd/geth to run without networking.
10 years ago
Felix Lange
9c7281c17e
p2p: make DiscReason bigger than byte
...
We decode into [1]DiscReason in a few places. That doesn't work anymore
because package rlp no longer accepts RLP lists for byte arrays.
10 years ago
Felix Lange
eedbb1ee9a
p2p/discover: use rlp.DecodeBytes
10 years ago
Felix Lange
56a48101dc
cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limit
10 years ago
Felix Lange
5528abc795
p2p: fix the dial timer
...
The dial timer was not reset properly when the peer count reached
MaxPeers.
10 years ago
obscuren
474aa924ca
p2p: added limiter function to limit package broadcasting
10 years ago
Felix Lange
0217652d1b
p2p/discover: improve timer handling for reply timeouts
10 years ago
Felix Lange
b8aeb04f6f
p2p/discover: remove unused field Node.activeStamp
10 years ago
Felix Lange
b9929d289d
p2p: fix unsynchronized map access during Server shutdown
...
removePeer can be called even after listenLoop and dialLoop have returned.
10 years ago
Felix Lange
995fab2ebc
p2p: fix yet another disconnect hang
...
Peer.readLoop will only terminate if the connection is closed. Fix the
hang by closing the connection before waiting for readLoop to terminate.
This also removes the british disconnect procedure where we're waiting
for the remote end to close the connection. I have confirmed with
@subtly that cpp-ethereum doesn't adhere to it either.
10 years ago
Felix Lange
79a6782c1c
p2p: fix goroutine leak when handshake read fails
...
This regression was introduced in b3c058a9e4
.
10 years ago
Felix Lange
c5332537f5
p2p: limit number of lingering inbound pre-handshake connections
...
This is supposed to apply some back pressure so Server is not accepting
more connections than it can actually handle. The current limit is 50.
This doesn't really need to be configurable, but we'll see how it
behaves in our test nodes and adjust accordingly.
10 years ago
Felix Lange
56977c225e
p2p: use RLock instead of Lock for pre-dial checks
10 years ago
Felix Lange
b3c058a9e4
p2p: improve disconnect signaling at handshake time
...
As of this commit, p2p will disconnect nodes directly after the
encryption handshake if too many peer connections are active.
Errors in the protocol handshake packet are now handled more politely
by sending a disconnect packet before closing the connection.
10 years ago
Felix Lange
99a1db2d40
p2p: don't mess with the socket deadline in Peer.readLoop
...
netWrapper already sets a read deadline in ReadMsg.
10 years ago
Felix Lange
145330fdf2
p2p: properly decrement peer wait group counter for setup errors
10 years ago
Felix Lange
f1d710af00
p2p: fix Peer shutdown deadlocks
...
There were multiple synchronization issues in the disconnect handling,
all caused by the odd special-casing of Peer.readLoop errors. Remove the
special handling of read errors and make readLoop part of the Peer
WaitGroup.
Thanks to @Gustav-Simonsson for pointing at arrows in a diagram
and playing rubber-duck.
10 years ago
Felix Lange
22d1f0faf1
p2p: improve peer selection logic
...
This commit introduces a new (temporary) peer selection
strategy based on random lookups.
While we're here, also implement the TODOs in dialLoop.
10 years ago
Felix Lange
7be05b4b9d
p2p/discover: don't log packet content
10 years ago
Felix Lange
9cd8c96157
p2p/discover: make packet processing less concurrent
10 years ago
obscuren
688d118c7e
Updated logging
10 years ago
Felix Lange
a77c431e37
p2p/discover: fix off by one error causing buckets to contain duplicates
10 years ago