obscuren
062fa049d0
fixed merge issue
2015-05-06 22:54:21 +02:00
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.
2015-05-06 16:10:41 +02:00
Péter Szilágyi
4accc187d5
eth, p2p: add trusted node list beside static list
2015-05-04 13:59:51 +03:00
Péter Szilágyi
54db54931e
p2p: add static node dialing test
2015-05-04 13:08:42 +03:00
Péter Szilágyi
e82ddd9198
p2p: correct a leftover trusted -> static
2015-04-30 19:34:33 +03:00
Péter Szilágyi
413ace37d3
eth, p2p: rename trusted nodes to static, drop inbound extra slots
2015-04-30 19:32:48 +03:00
Péter Szilágyi
701591b403
cmd, eth, p2p: fix review issues enumerated by Felix
2015-04-30 16:15:29 +03:00
Péter Szilágyi
1528dbc171
p2p: add trust check to handshake, test privileged connectivity
...
Conflicts:
p2p/server_test.go
2015-04-30 16:06:47 +03:00
Péter Szilágyi
14f32a0c3a
p2p: reduce the severity of a debug log
2015-04-30 16:04:09 +03:00
Péter Szilágyi
de0549fabb
cmd/geth, cmd/mist, cmd/utils, eth, p2p: support trusted peers
2015-04-30 16:03:10 +03:00
Felix Lange
72ab6d3255
p2p/discover: track sha3(ID) in Node
2015-04-30 15:02:23 +02:00
Felix Lange
b34a8ef624
p2p, p2p/discover: protocol version 4
2015-04-30 14:57:34 +02:00
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.
2015-04-30 14:57:33 +02:00
obscuren
01e3d694a6
p2p: added received at to peer message
...
p2p.Msg.ReceivedAt can be used for determining block propagation from
begining to end.
2015-04-29 22:49:58 +02:00
Péter Szilágyi
b569550a39
p2p/discover: fix api issues caused by leveldb update
2015-04-28 13:57:57 +03:00
Péter Szilágyi
4992765032
p2p/discover: fix goroutine leak due to blocking on sync.Once
2015-04-28 10:28:04 +03:00
Péter Szilágyi
437cf4b3ac
p2p/discover: add node expirer and related tests
2015-04-27 17:38:28 +03:00
Péter Szilágyi
a136e2bb22
p2p/discover: parametrize nodedb version, add persistency tests
2015-04-27 15:28:17 +03:00
Péter Szilágyi
75fd738dea
p2p/discover: drop a superfluous warning
2015-04-27 15:06:31 +03:00
Péter Szilágyi
706da56f75
p2p/discover: wrap the pinger to update the node db too
2015-04-27 14:56:42 +03:00
Péter Szilágyi
85b4b44235
p2p/discover: use iterator based seeding, drop old protocol test
2015-04-27 14:45:35 +03:00
Péter Szilágyi
8de8f61d36
p2p/discover: write the basic tests, catch RLP bug
2015-04-27 12:33:06 +03:00
Péter Szilágyi
0201c04b95
p2p/discovery: fix issues raised in the nodeDb PR
2015-04-27 10:19:16 +03:00
Péter Szilágyi
8646365b42
cmd/bootnode, eth, p2p, p2p/discover: use a fancier db design
2015-04-24 18:04:41 +03:00
Péter Szilágyi
6def110c37
cmd/bootnode, eth, p2p, p2p/discover: clean up the seeder and mesh into eth.
2015-04-24 11:33:55 +03:00
Péter Szilágyi
971702e7a1
p2p/discovery: fix broken tests due to API update
2015-04-24 11:23:20 +03:00
Péter Szilágyi
af923c965f
p2p/discovery: use the seed table for finding nodes, auto drop stale ones
2015-04-24 11:23:20 +03:00
Péter Szilágyi
5f735d6fce
cmd, eth, p2p, p2p/discover: init and clean up the seed cache
2015-04-24 11:23:20 +03:00
Felix Lange
936c8e19ff
p2p/discover: store nodes in leveldb
2015-04-24 11:23:20 +03:00
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.
2015-04-22 12:31:19 +02:00
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.
2015-04-17 14:45:10 +02:00
Felix Lange
eedbb1ee9a
p2p/discover: use rlp.DecodeBytes
2015-04-17 14:45:09 +02:00
Felix Lange
56a48101dc
cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limit
2015-04-17 14:45:09 +02:00
Felix Lange
5528abc795
p2p: fix the dial timer
...
The dial timer was not reset properly when the peer count reached
MaxPeers.
2015-04-17 08:17:01 +02:00
obscuren
474aa924ca
p2p: added limiter function to limit package broadcasting
2015-04-14 12:47:31 +02:00
Felix Lange
0217652d1b
p2p/discover: improve timer handling for reply timeouts
2015-04-13 18:08:11 +02:00
Felix Lange
b8aeb04f6f
p2p/discover: remove unused field Node.activeStamp
2015-04-13 17:44:14 +02:00
Felix Lange
b9929d289d
p2p: fix unsynchronized map access during Server shutdown
...
removePeer can be called even after listenLoop and dialLoop have returned.
2015-04-13 17:37:32 +02:00
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.
2015-04-13 17:34:08 +02:00
Felix Lange
79a6782c1c
p2p: fix goroutine leak when handshake read fails
...
This regression was introduced in b3c058a9e4
.
2015-04-13 17:06:19 +02:00
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.
2015-04-10 17:24:41 +02:00
Felix Lange
56977c225e
p2p: use RLock instead of Lock for pre-dial checks
2015-04-10 17:23:09 +02:00
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.
2015-04-10 16:57:56 +02:00
Felix Lange
99a1db2d40
p2p: don't mess with the socket deadline in Peer.readLoop
...
netWrapper already sets a read deadline in ReadMsg.
2015-04-10 13:26:28 +02:00
Felix Lange
145330fdf2
p2p: properly decrement peer wait group counter for setup errors
2015-04-10 13:26:27 +02:00
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.
2015-04-10 13:26:27 +02:00
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.
2015-04-10 13:26:27 +02:00
Felix Lange
7be05b4b9d
p2p/discover: don't log packet content
2015-04-10 13:26:27 +02:00
Felix Lange
9cd8c96157
p2p/discover: make packet processing less concurrent
2015-04-10 13:26:27 +02:00
obscuren
688d118c7e
Updated logging
2015-04-07 14:57:04 +02:00