relay: Let WriteBatch handle destination changes and drop the flush before responses

This commit is contained in:
JackDoan committed 2026-10-19 16:25:36 -05:00
1 parent d3e21a8fc8
commit 3db4c89e9e
3 files changed
+15 -85

No files matched your search

+4 -3
View File
@@ -384,8 +384,8 @@ type rxContext struct {
hostmapCache map[uint32]*HostInfo
lhh *LightHouseHandler
ctCache *firewall.ConntrackCacheTicker
relayBatch *batch.SendBatch
relayRemote netip.AddrPort
// relayBatch holds forwarded relay packets, which borrow their receive buffers until flushed
relayBatch *batch.SendBatch
}
func newRxContext(f *Interface, q int) *rxContext {
@@ -398,6 +398,7 @@ func newRxContext(f *Interface, q int) *rxContext {
hostmapCache: map[uint32]*HostInfo{},
lhh: f.lightHouse.NewRequestHandler(),
ctCache: firewall.NewConntrackCacheTicker(f.ctx, f.l, f.conntrackCacheTimeout),
relayBatch: batch.NewSendBatch(f.writers[q], batch.SendBatchCap, 0),
}
}
@@ -416,7 +417,7 @@ func (f *Interface) listenOut(i int) {
}
flusher := func() {
f.flushRelayBatch(rxc)
f.flushSendBatch(rxc.relayBatch, i)
if err := f.batchers[i].Flush(); err != nil {
f.l.Error("Failed to flush tun coalescer", "error", err)
}