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

Don't initialize RTC server when using external rtcd service #910

Merged
merged 1 commit into from
Dec 2, 2024
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
64 changes: 30 additions & 34 deletions server/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,50 +156,46 @@ func (p *Plugin) OnActivate() (retErr error) {
p.LogDebug("rtcd client manager initialized successfully")

p.rtcdManager = rtcdManager
} else {
rtcServerConfig := rtc.ServerConfig{
ICEAddressUDP: cfg.UDPServerAddress,
ICEAddressTCP: cfg.TCPServerAddress,
ICEPortUDP: *cfg.UDPServerPort,
ICEPortTCP: *cfg.TCPServerPort,
ICEHostOverride: cfg.ICEHostOverride,
ICEServers: rtc.ICEServers(cfg.getICEServers(false)),
TURNConfig: rtc.TURNConfig{
CredentialsExpirationMinutes: *cfg.TURNCredentialsExpirationMinutes,
},
EnableIPv6: *cfg.EnableIPv6,
}
if *cfg.ServerSideTURN {
rtcServerConfig.TURNConfig.StaticAuthSecret = cfg.TURNStaticAuthSecret
}
if cfg.ICEHostPortOverride != nil {
rtcServerConfig.ICEHostPortOverride = rtc.ICEHostPortOverride(fmt.Sprintf("%d", *cfg.ICEHostPortOverride))
}
rtcServer, err := rtc.NewServer(rtcServerConfig, newLogger(p), p.metrics.RTCMetrics())
if err != nil {
p.LogError(err.Error())
return err
}

go p.clusterEventsHandler()

p.LogDebug("activated", "ClusterID", status.ClusterId)

return nil
}
if err := rtcServer.Start(); err != nil {
p.LogError(err.Error())
return err
}

rtcServerConfig := rtc.ServerConfig{
ICEAddressUDP: cfg.UDPServerAddress,
ICEAddressTCP: cfg.TCPServerAddress,
ICEPortUDP: *cfg.UDPServerPort,
ICEPortTCP: *cfg.TCPServerPort,
ICEHostOverride: cfg.ICEHostOverride,
ICEServers: rtc.ICEServers(cfg.getICEServers(false)),
TURNConfig: rtc.TURNConfig{
CredentialsExpirationMinutes: *cfg.TURNCredentialsExpirationMinutes,
},
EnableIPv6: *cfg.EnableIPv6,
}
if *cfg.ServerSideTURN {
rtcServerConfig.TURNConfig.StaticAuthSecret = cfg.TURNStaticAuthSecret
}
if cfg.ICEHostPortOverride != nil {
rtcServerConfig.ICEHostPortOverride = rtc.ICEHostPortOverride(fmt.Sprintf("%d", *cfg.ICEHostPortOverride))
}
rtcServer, err := rtc.NewServer(rtcServerConfig, newLogger(p), p.metrics.RTCMetrics())
if err != nil {
p.LogError(err.Error())
return err
}
p.rtcServer = rtcServer

if err := rtcServer.Start(); err != nil {
p.LogError(err.Error())
return err
go p.wsWriter()
}

p.mut.Lock()
p.nodeID = status.ClusterId
p.rtcServer = rtcServer
p.mut.Unlock()

go p.clusterEventsHandler()
go p.wsWriter()

p.LogDebug("activated", "ClusterID", status.ClusterId)

Expand Down