Skip to content

Commit

Permalink
fix recycle
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Jul 27, 2024
1 parent 40de342 commit cc09441
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,19 +625,25 @@ func (s *UDPSession) postProcess() {

// 4. TxQueue
var msg ipv4.Message
for i := 0; i < s.dup+1; i++ {
msg.Addr = s.remote

// original copy, move buf to txqueue directly
msg.Buffers = [][]byte{buf}
txqueue = append(txqueue, msg)

// dup copies for testing if set
for i := 0; i < s.dup; i++ {
bts := xmitBuf.Get().([]byte)[:len(buf)]
copy(bts, buf)
msg.Buffers = [][]byte{bts}
msg.Addr = s.remote
txqueue = append(txqueue, msg)
}

// parity
for k := range ecc {
bts := xmitBuf.Get().([]byte)[:len(ecc[k])]
copy(bts, ecc[k])
msg.Buffers = [][]byte{bts}
msg.Addr = s.remote
txqueue = append(txqueue, msg)
}

Expand Down

0 comments on commit cc09441

Please sign in to comment.