Skip to content

Commit

Permalink
dynamic priority for memory reservation; first buffer is an always.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Feb 28, 2022
1 parent 3b7b43d commit abd728e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion multiplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@ func NewMultiplex(con net.Conn, initiator bool, memoryManager MemoryManager) (*M
bufs := 0
var err error
for i := 0; i < MaxBuffers; i++ {
if err = mp.memoryManager.ReserveMemory(2*MaxMessageSize, 128); err != nil {
var prio uint8
switch bufs {
case 0:
prio = 255
case 1:
prio = 192
default:
prio = 128
}
if err = mp.memoryManager.ReserveMemory(2*MaxMessageSize, prio); err != nil {
break
}
bufs++
Expand Down

0 comments on commit abd728e

Please sign in to comment.