wgengine/magicsock: avoid some log spam on Plan 9

Updates #5794

Change-Id: I12e8417ebd553f9951690c388fbe42228f8c9097
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2025-04-01 04:01:00 -07:00 committed by Brad Fitzpatrick
parent 60847128df
commit e3282c1632

View File

@ -3018,6 +3018,10 @@ func (c *Conn) DebugForcePreferDERP(n int) {
// portableTrySetSocketBuffer sets SO_SNDBUF and SO_RECVBUF on pconn to socketBufferSize, // portableTrySetSocketBuffer sets SO_SNDBUF and SO_RECVBUF on pconn to socketBufferSize,
// logging an error if it occurs. // logging an error if it occurs.
func portableTrySetSocketBuffer(pconn nettype.PacketConn, logf logger.Logf) { func portableTrySetSocketBuffer(pconn nettype.PacketConn, logf logger.Logf) {
if runtime.GOOS == "plan9" {
// Not supported. Don't try. Avoid logspam.
return
}
if c, ok := pconn.(*net.UDPConn); ok { if c, ok := pconn.(*net.UDPConn); ok {
// Attempt to increase the buffer size, and allow failures. // Attempt to increase the buffer size, and allow failures.
if err := c.SetReadBuffer(socketBufferSize); err != nil { if err := c.SetReadBuffer(socketBufferSize); err != nil {