Rework outbound buffer management
Outbound element buffers now come from the sing allocator sized to the actual packet instead of the bounded MaxMessageSize pool, element and container pools become plain sync.Pools, and the bounded message buffer pool serves only the receive path. Packets injected via InputPacket/InputPackets are dropped before they are copied once a peer has 2048 packets queued: injection runs on the caller's read loop, which must never block on pool exhaustion, and the queues are bounded in containers, so a flood was buffered instead of dropped.
This commit is contained in:
parent
9de6dc32df
commit
8403cdb937
5 changed files with 78 additions and 35 deletions
|
|
@ -71,11 +71,11 @@ type Device struct {
|
|||
cookieChecker CookieChecker
|
||||
|
||||
pool struct {
|
||||
inboundElementsContainer *WaitPool
|
||||
outboundElementsContainer *WaitPool
|
||||
inboundElementsContainer *sync.Pool
|
||||
outboundElementsContainer *sync.Pool
|
||||
messageBuffers *WaitPool
|
||||
inboundElements *WaitPool
|
||||
outboundElements *WaitPool
|
||||
inboundElements *sync.Pool
|
||||
outboundElements *sync.Pool
|
||||
}
|
||||
|
||||
queue struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue