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
|
DiscUnexpectedIdentity
|
||||||
DiscSelf
|
DiscSelf
|
||||||
DiscReadTimeout
|
DiscReadTimeout
|
||||||
|
DiscTooManyInboundConnections
|
||||||
DiscSubprotocolError = 0x10
|
DiscSubprotocolError = 0x10
|
||||||
)
|
)
|
||||||
|
|
||||||
var discReasonToString = [...]string{
|
var discReasonToString = [...]string{
|
||||||
DiscRequested: "disconnect requested",
|
DiscRequested: "disconnect requested",
|
||||||
DiscNetworkError: "network error",
|
DiscNetworkError: "network error",
|
||||||
DiscProtocolError: "breach of protocol",
|
DiscProtocolError: "breach of protocol",
|
||||||
DiscUselessPeer: "useless peer",
|
DiscUselessPeer: "useless peer",
|
||||||
DiscTooManyPeers: "too many peers",
|
DiscTooManyPeers: "too many peers",
|
||||||
DiscAlreadyConnected: "already connected",
|
DiscTooManyInboundConnections: "too many inbound connections",
|
||||||
DiscIncompatibleVersion: "incompatible p2p protocol version",
|
DiscAlreadyConnected: "already connected",
|
||||||
DiscInvalidIdentity: "invalid node identity",
|
DiscIncompatibleVersion: "incompatible p2p protocol version",
|
||||||
DiscQuitting: "client quitting",
|
DiscInvalidIdentity: "invalid node identity",
|
||||||
DiscUnexpectedIdentity: "unexpected identity",
|
DiscQuitting: "client quitting",
|
||||||
DiscSelf: "connected to self",
|
DiscUnexpectedIdentity: "unexpected identity",
|
||||||
DiscReadTimeout: "read timeout",
|
DiscSelf: "connected to self",
|
||||||
DiscSubprotocolError: "subprotocol error",
|
DiscReadTimeout: "read timeout",
|
||||||
|
DiscSubprotocolError: "subprotocol error",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d DiscReason) String() string {
|
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:
|
case !c.is(trustedConn|staticDialedConn) && len(peers) >= srv.MaxPeers:
|
||||||
return DiscTooManyPeers
|
return DiscTooManyPeers
|
||||||
case !c.is(trustedConn) && c.is(inboundConn) && inboundCount >= srv.maxInboundConns():
|
case !c.is(trustedConn) && c.is(inboundConn) && inboundCount >= srv.maxInboundConns():
|
||||||
return DiscTooManyPeers
|
return DiscTooManyInboundConnections
|
||||||
case peers[c.node.ID()] != nil:
|
case peers[c.node.ID()] != nil:
|
||||||
return DiscAlreadyConnected
|
return DiscAlreadyConnected
|
||||||
case c.node.ID() == srv.localnode.ID():
|
case c.node.ID() == srv.localnode.ID():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue