From d6ed7cc0d40e58e64c17f7441eb4b496628533d4 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 25 Mar 2021 08:20:11 +0000 Subject: [PATCH] add ability to configure SRTO_LOSSMAXTTL --- config/config.go | 2 ++ main.go | 1 + srt/server.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/config/config.go b/config/config.go index 2b06451..2382e59 100644 --- a/config/config.go +++ b/config/config.go @@ -22,6 +22,7 @@ type AppConfig struct { Latency uint Buffersize uint SyncClients bool + LossMaxTTL uint } type AuthConfig struct { @@ -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, }, diff --git a/main.go b/main.go index 0e26be9..3806615 100644 --- a/main.go +++ b/main.go @@ -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, }, diff --git a/srt/server.go b/srt/server.go index b313aa9..6a74e3f 100644 --- a/srt/server.go +++ b/srt/server.go @@ -33,6 +33,7 @@ type ServerConfig struct { Address string Port uint16 Latency uint + LossMaxTTL uint Auth auth.Authenticator SyncClients bool } @@ -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)