Skip to content

ratelimit: make it a global limit and invert #655

@Choraden

Description

@Choraden

Currently the limits have confusing logic:

if rl, wl := l.ReadLimit, l.WriteLimit; rl > 0 || wl > 0 {
	// Notice that the ReadLimit stands for the read limit *from* a proxy, and the WriteLimit
	// stands for the write limit *to* a proxy, thus the ReadLimit is in fact
	// a txBandwidth and the WriteLimit is a rxBandwidth.
	ll = ratelimit.NewListener(ll, wl, rl)
}

Invert that and share the limit across all connections.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions