Skip to content

Commit f0c30eb

Browse files
committed
🗝️ conn: make MaxUDPGSOSegments useful
1 parent 4382a2f commit f0c30eb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

conn/conn.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type SocketInfo struct {
1515
// If UDP GSO is not enabled on the socket, or the system does not support UDP GSO, the value is 1.
1616
//
1717
// The value is 0 if the socket is not a UDP socket.
18-
MaxUDPGSOSegments int
18+
MaxUDPGSOSegments uint32
1919

2020
// UDPGenericReceiveOffload indicates whether UDP GRO is enabled on the socket.
2121
UDPGenericReceiveOffload bool
@@ -80,6 +80,7 @@ func (lc *ListenConfig) ListenTCP(ctx context.Context, network, address string)
8080

8181
// ListenUDP wraps [net.ListenConfig.ListenPacket] and returns a [*net.UDPConn] directly.
8282
func (lc *ListenConfig) ListenUDP(ctx context.Context, network, address string) (uc *net.UDPConn, info SocketInfo, err error) {
83+
info.MaxUDPGSOSegments = 1
8384
nlc := lc.tlc.ListenConfig
8485
nlc.Control = lc.fns.controlFunc(&info)
8586
pc, err := nlc.ListenPacket(ctx, network, address)

conn/conn_mmsg.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
// ListenUDPRawConn is like [ListenUDP] but wraps the [*net.UDPConn] in a [rawUDPConn] for batch I/O.
1111
func (lc *ListenConfig) ListenUDPRawConn(ctx context.Context, network, address string) (c rawUDPConn, info SocketInfo, err error) {
12+
info.MaxUDPGSOSegments = 1
1213
nlc := lc.tlc.ListenConfig
1314
nlc.Control = lc.fns.controlFunc(&info)
1415
pc, err := nlc.ListenPacket(ctx, network, address)

0 commit comments

Comments
 (0)