mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
use SO_RCVBUFFORCE to force receive buffer increase on Linux (#3804)
* Add ability to force change the receive buffer size using SO_RCVBUFFORCE in Linux * Fix imports * Update test * Add sys_conn_helper_not_linux * Rename file * ignore the error on SetReadBuffer * also run unit tests as root --------- Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This commit is contained in:
parent
da198b710b
commit
843b633434
5 changed files with 90 additions and 5 deletions
13
transport.go
13
transport.go
|
@ -180,10 +180,17 @@ func setReceiveBuffer(c net.PacketConn, logger utils.Logger) error {
|
|||
logger.Debugf("Conn has receive buffer of %d kiB (wanted: at least %d kiB)", size/1024, protocol.DesiredReceiveBufferSize/1024)
|
||||
return nil
|
||||
}
|
||||
if err := conn.SetReadBuffer(protocol.DesiredReceiveBufferSize); err != nil {
|
||||
return fmt.Errorf("failed to increase receive buffer size: %w", err)
|
||||
}
|
||||
// Ignore the error. We check if we succeeded by querying the buffer size afterward.
|
||||
_ = conn.SetReadBuffer(protocol.DesiredReceiveBufferSize)
|
||||
newSize, err := inspectReadBuffer(c)
|
||||
if newSize < protocol.DesiredReceiveBufferSize {
|
||||
// Try again with RCVBUFFORCE on Linux
|
||||
_ = forceSetReceiveBuffer(c, protocol.DesiredReceiveBufferSize)
|
||||
newSize, err = inspectReadBuffer(c)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to determine receive buffer size: %w", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to determine receive buffer size: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue