Skip to content

Commit

Permalink
[relay] Set InitialPacketSize to the maximum allowable value (#3188)
Browse files Browse the repository at this point in the history
Fixes an issue on macOS where the server throws errors with default settings:
failed to write transport message to: DATAGRAM frame too large.

Further investigation is required to optimize MTU-related values.
  • Loading branch information
pappz authored Jan 16, 2025
1 parent bc7b2c6 commit 481bbe8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions relay/client/dialer/quic/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ func (d Dialer) Dial(ctx context.Context, address string) (net.Conn, error) {
}

quicConfig := &quic.Config{
KeepAlivePeriod: 30 * time.Second,
MaxIdleTimeout: 4 * time.Minute,
EnableDatagrams: true,
KeepAlivePeriod: 30 * time.Second,
MaxIdleTimeout: 4 * time.Minute,
EnableDatagrams: true,
InitialPacketSize: 1452,
}

udpConn, err := nbnet.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0})
Expand Down
3 changes: 2 additions & 1 deletion relay/server/listener/quic/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func (l *Listener) Listen(acceptFn func(conn net.Conn)) error {
l.acceptFn = acceptFn

quicCfg := &quic.Config{
EnableDatagrams: true,
EnableDatagrams: true,
InitialPacketSize: 1452,
}
listener, err := quic.ListenAddr(l.Address, l.TLSConfig, quicCfg)
if err != nil {
Expand Down

0 comments on commit 481bbe8

Please sign in to comment.