Skip to content

Commit

Permalink
add ability to configure SRTO_LOSSMAXTTL
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 authored and iSchluff committed Mar 26, 2021
1 parent 4c55c80 commit d6ed7cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type AppConfig struct {
Latency uint
Buffersize uint
SyncClients bool
LossMaxTTL uint
}

type AuthConfig struct {
Expand Down Expand Up @@ -55,6 +56,7 @@ func Parse(paths []string) (*Config, error) {
App: AppConfig{
Address: "127.0.0.1:1337",
Latency: 200,
LossMaxTTL: 0,
Buffersize: 384000,
SyncClients: false,
},
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func main() {
Server: srt.ServerConfig{
Address: conf.App.Address,
Latency: conf.App.Latency,
LossMaxTTL: conf.App.LossMaxTTL,
SyncClients: conf.App.SyncClients,
Auth: auth,
},
Expand Down
2 changes: 2 additions & 0 deletions srt/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type ServerConfig struct {
Address string
Port uint16
Latency uint
LossMaxTTL uint
Auth auth.Authenticator
SyncClients bool
}
Expand Down Expand Up @@ -103,6 +104,7 @@ func (s *ServerImpl) listenAt(ctx context.Context, host string, port uint16) err
options["latency"] = strconv.Itoa(int(s.config.Latency))

sck := srtgo.NewSrtSocket(host, port, options)
sck.SetSockOptInt(srtgo.SRTO_LOSSMAXTTL, int(s.config.LossMaxTTL))
err := sck.Listen(1)
if err != nil {
return fmt.Errorf("Listen failed: %v", err)
Expand Down

0 comments on commit d6ed7cc

Please sign in to comment.