forked from quic-go/quic-go
add a function to set the UDP send buffer size
This function is the equivalent to the function used to set the UDP receive buffer size. It's so similar that code generation is used to make a copy of the setReceiveBuffer function.
This commit is contained in:
@@ -31,3 +31,13 @@ func forceSetReceiveBuffer(c syscall.RawConn, bytes int) error {
|
||||
}
|
||||
return serr
|
||||
}
|
||||
|
||||
func forceSetSendBuffer(c syscall.RawConn, bytes int) error {
|
||||
var serr error
|
||||
if err := c.Control(func(fd uintptr) {
|
||||
serr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_SNDBUFFORCE, bytes)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return serr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user