Skip to content

Commit

Permalink
Move EnableNODELAY flag to stayrtr.go where it belongs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjeker committed Aug 7, 2024
1 parent 38ded59 commit e5bb06b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cmd/stayrtr/stayrtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
EnforceVersion = flag.Bool("enforce.version", false, "Disable version negotiation")
DisableBGPSec = flag.Bool("disable.bgpsec", false, "Disable sending out BGPSEC Router Keys")
DisableASPA = flag.Bool("disable.aspa", false, "Disable sending out ASPA objects")
EnableNODELAY = flag.Bool("enable.nodelay", false, "Force enable TCP NODELAY (Likely increases CPU)")


Bind = flag.String("bind", ":8282", "Bind address")
Expand Down Expand Up @@ -763,6 +764,7 @@ func run() error {
EnforceVersion: *EnforceVersion,
DisableBGPSec: *DisableBGPSec,
DisableASPA: *DisableASPA,
EnableNODELAY: *EnableNODELAY,
}

var me *metricsEvent
Expand Down
10 changes: 5 additions & 5 deletions lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ type Server struct {
enforceVersion bool
disableBGPSec bool
disableASPA bool
enableNODELAY bool

sdlock *sync.RWMutex
sdListDiff [][]SendableData
Expand All @@ -158,8 +159,9 @@ type ServerConfiguration struct {

SessId int

DisableBGPSec bool
DisableASPA bool
DisableBGPSec bool
DisableASPA bool
EnableNODELAY bool

RefreshInterval uint32
RetryInterval uint32
Expand Down Expand Up @@ -487,10 +489,8 @@ func (s *Server) Start(bind string) error {
return s.loopTCP(tcplist, "tcp", s.acceptClientTCP)
}

var EnableNODELAY = flag.Bool("enable.nodelay", false, "Force enable TCP NODELAY (Likely increases CPU)")

func (s *Server) acceptClientTCP(tcpconn net.Conn) error {
if !*EnableNODELAY {
if !s.enableNODELAY {
tc, ok := tcpconn.(*net.TCPConn)
if ok {
tc.SetNoDelay(false)
Expand Down

0 comments on commit e5bb06b

Please sign in to comment.