mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
p2p: too many inbound connections
This commit is contained in:
parent
e57e4571d3
commit
951501e63c
2 changed files with 16 additions and 14 deletions
|
|
@ -69,23 +69,25 @@ const (
|
|||
DiscUnexpectedIdentity
|
||||
DiscSelf
|
||||
DiscReadTimeout
|
||||
DiscTooManyInboundConnections
|
||||
DiscSubprotocolError = 0x10
|
||||
)
|
||||
|
||||
var discReasonToString = [...]string{
|
||||
DiscRequested: "disconnect requested",
|
||||
DiscNetworkError: "network error",
|
||||
DiscProtocolError: "breach of protocol",
|
||||
DiscUselessPeer: "useless peer",
|
||||
DiscTooManyPeers: "too many peers",
|
||||
DiscAlreadyConnected: "already connected",
|
||||
DiscIncompatibleVersion: "incompatible p2p protocol version",
|
||||
DiscInvalidIdentity: "invalid node identity",
|
||||
DiscQuitting: "client quitting",
|
||||
DiscUnexpectedIdentity: "unexpected identity",
|
||||
DiscSelf: "connected to self",
|
||||
DiscReadTimeout: "read timeout",
|
||||
DiscSubprotocolError: "subprotocol error",
|
||||
DiscRequested: "disconnect requested",
|
||||
DiscNetworkError: "network error",
|
||||
DiscProtocolError: "breach of protocol",
|
||||
DiscUselessPeer: "useless peer",
|
||||
DiscTooManyPeers: "too many peers",
|
||||
DiscTooManyInboundConnections: "too many inbound connections",
|
||||
DiscAlreadyConnected: "already connected",
|
||||
DiscIncompatibleVersion: "incompatible p2p protocol version",
|
||||
DiscInvalidIdentity: "invalid node identity",
|
||||
DiscQuitting: "client quitting",
|
||||
DiscUnexpectedIdentity: "unexpected identity",
|
||||
DiscSelf: "connected to self",
|
||||
DiscReadTimeout: "read timeout",
|
||||
DiscSubprotocolError: "subprotocol error",
|
||||
}
|
||||
|
||||
func (d DiscReason) String() string {
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ func (srv *Server) encHandshakeChecks(peers map[enode.ID]*Peer, inboundCount int
|
|||
case !c.is(trustedConn|staticDialedConn) && len(peers) >= srv.MaxPeers:
|
||||
return DiscTooManyPeers
|
||||
case !c.is(trustedConn) && c.is(inboundConn) && inboundCount >= srv.maxInboundConns():
|
||||
return DiscTooManyPeers
|
||||
return DiscTooManyInboundConnections
|
||||
case peers[c.node.ID()] != nil:
|
||||
return DiscAlreadyConnected
|
||||
case c.node.ID() == srv.localnode.ID():
|
||||
|
|
|
|||
Loading…
Reference in a new issue