Skip to content

Commit ced4a37

Browse files
Added a minimum bytes allocation to peers
1 parent 7f572a1 commit ced4a37

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

network/peer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ func (p *peer) send(msg Msg) bool {
197197
newPendingBytes := p.net.pendingBytes + len(msgBytes)
198198
newConnPendingBytes := p.pendingBytes + len(msgBytes)
199199
if newPendingBytes > p.net.networkPendingSendBytesToRateLimit && // Check to see if we should be enforcing any rate limiting
200+
uint32(p.pendingBytes) > p.net.maxMessageSize && // this connection should have a minimum allowed bandwidth
200201
(newPendingBytes > p.net.maxNetworkPendingSendBytes || // Check to see if this message would put too much memory into the network
201202
newConnPendingBytes > p.net.maxNetworkPendingSendBytes/20) { // Check to see if this connection is using too much memory
202203
p.net.log.Debug("dropping message to %s due to a send queue with too many bytes", p.id)

0 commit comments

Comments
 (0)