diff --git a/sys_conn.go b/sys_conn.go index 463a45640..29aa6add2 100644 --- a/sys_conn.go +++ b/sys_conn.go @@ -25,12 +25,16 @@ var _ OOBCapablePacketConn = &net.UDPConn{} // OptimizeConn takes a net.PacketConn and attempts to enable various optimizations that will improve QUIC performance: // 1. It enables the Don't Fragment (DF) bit on the IP header. -// This allows us to do DPLPMTUD (Path MTU Discovery). +// This is required to run DPLPMTUD (Path MTU Discovery, RFC 8899). // 2. It enables reading of the ECN bits from the IP header. // This allows the remote node to speed up its loss detection and recovery. // 3. It uses batched syscalls (recvmmsg) to more efficiently receive packets from the socket. +// 4. It uses Generic Segmentation Offload (GSO) to efficiently send batches of packets (on Linux). // -// For this to work, the connection needs to implement the OOBCapablePacketConn interface (as a *net.UDPConn does). +// In order for this to work, the connection needs to implement the OOBCapablePacketConn interface (as a *net.UDPConn does). +// +// It's only necessary to call this function explicitly if the application calls WriteTo +// after passing the connection to the Transport. func OptimizeConn(c net.PacketConn) (net.PacketConn, error) { return wrapConn(c) } diff --git a/transport.go b/transport.go index 3bc11d3bd..7590be326 100644 --- a/transport.go +++ b/transport.go @@ -31,7 +31,8 @@ type Transport struct { // Bad things will happen if passed to multiple Transports. // // If not done by the user, the connection is passed through OptimizeConn to enable a number of optimizations. - // After passing the connection to the Transport, its invalid to call ReadFrom and WriteTo. + // After passing the connection to the Transport, it's invalid to call ReadFrom on the connection. + // Calling WriteTo is only valid on the connection returned by OptimizeConn. Conn net.PacketConn // The length of the connection ID in bytes.