Commit Graph

19 Commits

Author SHA1 Message Date
Håvard Anda Estensen
138f0d7494
p2p: use errors.Is for error comparison (#24882)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-06-07 17:27:21 +02:00
henopied
63972e7548
p2p: fix type of DiscSubprotocolError (#24747)
It was 'int' accidentally, should be DiscReason instead.
2022-04-25 11:05:47 +02:00
Felix Lange
870b4505a0
p2p: define DiscReason as uint8 (#24507)
All other implementations store disconnect reasons as a single byte,
so go-ethereum should do it too.
2022-03-07 18:25:45 +01:00
Evolution404
5afc82de6e
p2p: fix array out of bounds issue (#23165) 2021-07-06 09:33:51 +02:00
kiel barry
864e80a48f p2p: fix some golint warnings (#16577) 2018-05-08 13:08:43 +02:00
Felix Lange
96ae35e2ac p2p, p2p/discover, p2p/nat: rework logging using context keys 2017-02-28 10:20:29 +01:00
Felix Lange
0d10d5a0a5 p2p: fix value of DiscSubprotocolError
We had the wrong value (12) since forever.
2015-08-12 14:15:54 +02:00
Felix Lange
bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange
3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange
ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Felix Lange
1440f9a37a p2p: new dialer, peer management without locks
The most visible change is event-based dialing, which should be an
improvement over the timer-based system that we have at the moment.
The dialer gets a chance to compute new tasks whenever peers change or
dials complete. This is better than checking peers on a timer because
dials happen faster. The dialer can now make more precise decisions
about whom to dial based on the peer set and we can test those
decisions without actually opening any sockets.

Peer management is easier to test because the tests can inject
connections at checkpoints (after enc handshake, after protocol
handshake).

Most of the handshake stuff is now part of the RLPx code. It could be
exported or move to its own package because it is no longer entangled
with Server logic.
2015-05-25 01:17:14 +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
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
e34d134102 p2p: fixes for actual connections
The unit test hooks were turned on 'in production'.
2015-02-07 00:43:52 +01:00
Felix Lange
5bdc115943 p2p: integrate p2p/discover
Overview of changes:

- ClientIdentity has been removed, use discover.NodeID
- Server now requires a private key to be set (instead of public key)
- Server performs the encryption handshake before launching Peer
- Dial logic takes peers from discover table
- Encryption handshake code has been cleaned up a bit
- baseProtocol is gone because we don't exchange peers anymore
- Some parts of baseProtocol have moved into Peer instead
2015-02-06 00:00:36 +01:00
Felix Lange
f0f6727778 p2p: use an error type for disconnect requests
Test-tastic.
2014-12-15 00:28:20 +01:00
Felix Lange
59b63caf5e p2p: API cleanup and PoC 7 compatibility
Whoa, one more big commit. I didn't manage to untangle the
changes while working towards compatibility.
2014-11-21 21:52:45 +01:00
Felix Lange
f38052c499 p2p: rework protocol API 2014-11-21 21:52:45 +01:00
zelig
771fbcc02e initial commit of p2p package 2014-10-23 16:57:54 +01:00