tell stupid ai not to meddle with the paths on other platforms by adding a copy

This commit is contained in:
Ryan Huber
2025-10-31 14:16:02 -04:00
parent 68746bd907
commit 29157f413c
5 changed files with 21 additions and 13 deletions

View File

@@ -344,6 +344,9 @@ func NewInterface(ctx context.Context, c *InterfaceConfig) (*Interface, error) {
if decryptWorkers < 0 {
decryptWorkers = 0
}
if runtime.GOOS != "linux" {
decryptWorkers = 0
}
queueDepth := c.DecryptQueueDepth
if queueDepth <= 0 {

View File

@@ -180,9 +180,7 @@ func (u *StdConn) ListenOut(r EncReader) {
u.l.WithError(err).Error("unexpected udp socket receive error")
}
payload := make([]byte, n)
copy(payload, buffer[:n])
r(netip.AddrPortFrom(rua.Addr().Unmap(), rua.Port()), payload, func() {})
r(netip.AddrPortFrom(rua.Addr().Unmap(), rua.Port()), buffer[:n], nil)
}
}

View File

@@ -82,8 +82,6 @@ func (u *GenericConn) ListenOut(r EncReader) {
return
}
payload := make([]byte, n)
copy(payload, buffer[:n])
r(netip.AddrPortFrom(rua.Addr().Unmap(), rua.Port()), payload, func() {})
r(netip.AddrPortFrom(rua.Addr().Unmap(), rua.Port()), buffer[:n], nil)
}
}

View File

@@ -452,12 +452,23 @@ func (s *sendShard) flushPendingLocked() error {
if queue == nil {
err = s.processTask(task)
} else {
sent := false
func() {
defer func() {
if r := recover(); r != nil {
err = s.processTask(task)
sent = true
}
}()
queue <- task
select {
case queue <- task:
sent = true
default:
}
}()
if !sent {
err = s.processTask(task)
}
}
s.mu.Lock()
return err

View File

@@ -149,9 +149,7 @@ func (u *RIOConn) ListenOut(r EncReader) {
continue
}
payload := make([]byte, n)
copy(payload, buffer[:n])
r(netip.AddrPortFrom(netip.AddrFrom16(rua.Addr).Unmap(), (rua.Port>>8)|((rua.Port&0xff)<<8)), payload, func() {})
r(netip.AddrPortFrom(netip.AddrFrom16(rua.Addr).Unmap(), (rua.Port>>8)|((rua.Port&0xff)<<8)), buffer[:n], nil)
}
}