Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove sysctl dependency from start command #4068

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/celestia-appd/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime/pprof"
"strings"
Expand Down Expand Up @@ -580,6 +579,8 @@ sudo sysctl -p

Then verify BBR is enabled:
sysctl net.ipv4.tcp_congestion_control
or
cat /proc/sys/net/ipv4/tcp_congestion_control

This node will get worse p2p performance using a different congestion control algorithm.
If you need to bypass this check use the --force-no-bbr flag.
Expand All @@ -594,16 +595,15 @@ If you need to bypass this check use the --force-no-bbr flag.
return nil
}

cmd := exec.Command("sysctl", "net.ipv4.tcp_congestion_control")
output, err := cmd.Output()
file, err := os.ReadFile("/proc/sys/net/ipv4/tcp_congestion_control")
if err != nil {
fmt.Print(warning)
return fmt.Errorf("failed to execute 'sysctl net.ipv4.tcp_congestion_control' %w", err)
return fmt.Errorf("failed to read file '/proc/sys/net/ipv4/tcp_congestion_control' %w", err)
}

if !strings.Contains(string(output), "bbr") {
if !strings.Contains(string(file), "bbr") {
fmt.Print(warning)
return fmt.Errorf("BBR not enabled because output %v does not contain 'bbr'", string(output))
return fmt.Errorf("BBR not enabled because output %v does not contain 'bbr'", string(file))
}

return nil
Expand Down
Loading