Преглед изворни кода

Fix: add missing quic.muxPacketConn.SetWriteBuffer passthrough

Rod Hynes пре 2 година
родитељ
комит
8565488997
1 измењених фајлова са 13 додато и 3 уклоњено
  1. 13 3
      psiphon/common/quic/quic.go

+ 13 - 3
psiphon/common/quic/quic.go

@@ -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
@@ -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)