Skip to content

Commit

Permalink
Fix: add missing quic.muxPacketConn.SetWriteBuffer passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-hynes committed Jan 15, 2024
1 parent 27b8b1b commit 8565488
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions psiphon/common/quic/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,10 @@ func (conn *muxPacketConn) SetWriteDeadline(t time.Time) error {
return errors.TraceNew("not supported")
}

// SetReadBuffer and SyscallConn provide passthroughs to the underlying
// net.UDPConn implementations, used to optimize the UDP receive buffer size.
// SetReadBuffer, SetWriteBuffer, and SyscallConn provide passthroughs to the
// underlying net.UDPConn implementations, used to optimize UDP buffer sizes.
// See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size
// and ietf_quic.setReceiveBuffer. Only the IETF stack will access these
// and ietf_quic.setReceive/SendBuffer. Only the IETF stack will access these
// functions.
//
// Limitation: due to the relayPackets/ReadFrom scheme, this simple
Expand All @@ -1125,6 +1125,16 @@ func (conn *muxPacketConn) SetReadBuffer(bytes int) error {
return c.SetReadBuffer(bytes)
}

func (conn *muxPacketConn) SetWriteBuffer(bytes int) error {
c, ok := conn.listener.conn.PacketConn.(interface {
SetWriteBuffer(int) error
})
if !ok {
return errors.TraceNew("not supported")
}
return c.SetWriteBuffer(bytes)
}

func (conn *muxPacketConn) SyscallConn() (syscall.RawConn, error) {
c, ok := conn.listener.conn.PacketConn.(interface {
SyscallConn() (syscall.RawConn, error)
Expand Down

0 comments on commit 8565488

Please sign in to comment.