Skip to content

Commit

Permalink
add --read-timeout, --write-timeout, --idle-timeout (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Aug 7, 2023
1 parent 0603617 commit 9073111
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,13 @@ var cli struct {
Quiet bool `short:"q" help:"suppress info messages."`
Print bool `help:"print routed frames."`
PrintErrors bool
HbDisable bool `help:"disable heartbeats."`
HbVersion string `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
HbSystemid int `default:"125"`
HbPeriod int `help:"set period of heartbeats." default:"5"`
ReadTimeout time.Duration `help:"timeout of read operations." default:"10s"`
WriteTimeout time.Duration `help:"timeout of write operations." default:"10s"`
IdleTimeout time.Duration `help:"disconnect idle connections after a timeout." default:"60s"`
HbDisable bool `help:"disable heartbeats."`
HbVersion string `enum:"1,2" help:"set mavlink version of heartbeats." default:"1"`
HbSystemid int `default:"125"`
HbPeriod int `help:"set period of heartbeats." default:"5"`
StreamreqDisable bool
StreamreqFrequency int `help:"set the stream frequency to request." default:"4"`
Endpoints []string `arg:"" optional:""`
Expand Down Expand Up @@ -238,6 +241,9 @@ func newProgram(args []string) (*program, error) {
HeartbeatPeriod: (time.Duration(cli.HbPeriod) * time.Second),
StreamRequestEnable: !cli.StreamreqDisable,
StreamRequestFrequency: cli.StreamreqFrequency,
ReadTimeout: cli.ReadTimeout,
WriteTimeout: cli.WriteTimeout,
IdleTimeout: cli.IdleTimeout,
})
if err != nil {
ctxCancel()
Expand Down

0 comments on commit 9073111

Please sign in to comment.