why does it work

This commit is contained in:
JackDoan
2025-11-11 19:12:50 -06:00
parent 17a6917428
commit c026e8624a
2 changed files with 4 additions and 4 deletions

View File

@@ -313,7 +313,7 @@ func (f *Interface) listenOut(q int) {
func (f *Interface) listenIn(reader overlay.TunDev, queueNum int) {
runtime.LockOSThread()
const batch = 64
const batch = 128
originalPackets := make([][]byte, batch) //todo batch config
for i := 0; i < batch; i++ {
originalPackets[i] = make([]byte, 0xffff)

View File

@@ -211,7 +211,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
iovs := make([][]iovec, 0, len(pkts))
sent := 0
const maxIovLen = 48
var mostRecentPkt *packet.Packet
//segmenting := false
idx := 0
@@ -221,7 +221,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
continue
}
lastIdx := idx - 1
if mostRecentPkt != nil && pkt.CompatibleForSegmentationWith(mostRecentPkt) && msgs[lastIdx].Hdr.Iovlen < 4 {
if mostRecentPkt != nil && pkt.CompatibleForSegmentationWith(mostRecentPkt) && msgs[lastIdx].Hdr.Iovlen < maxIovLen { //todo math this more good
msgs[lastIdx].Hdr.Controllen = uint64(len(mostRecentPkt.Control))
msgs[lastIdx].Hdr.Control = &mostRecentPkt.Control[0]
@@ -233,7 +233,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
mostRecentPkt.SetSegSizeForTX()
} else {
msgs = append(msgs, rawMessage{})
iovs = append(iovs, make([]iovec, 1, 8)) //todo
iovs = append(iovs, make([]iovec, 1, maxIovLen)) //todo
iovs[idx][0] = iovec{
Base: &pkt.Payload[0],
Len: uint64(len(pkt.Payload)),