Merge HimbeerserverDE:main -> ev2-1:texturePools

master
Riley 2022-05-01 10:26:33 +02:00
commit 8c912346ba
1 changed files with 15 additions and 6 deletions

View File

@ -114,7 +114,14 @@ AddLoop:
return srvs
}
// AddServer appends a server to the list of configured servers.
// AddServer dynamically configures a new Server at runtime.
// Servers added in this way are ephemeral and will be lost
// when the proxy shuts down.
// For the media to work you have to specify an alternative
// media source that is always available, even if the server
// is offline.
// WARNING: Reloading the configuration file deletes the
// servers added using this function.
func AddServer(server Server) bool {
configMu.Lock()
defer configMu.Unlock()
@ -129,19 +136,21 @@ func AddServer(server Server) bool {
return true
}
// DelServer removes a server based on name.
func DelServer(name string) bool {
// RmServer deletes a Server from the Config at runtime.
// Any server can be deleted this way, not just the ones
// added using AddServer.
// WARNING: Reloading the configuration files re-adds the
// servers it contains that were deleted using this function.
func RmServer(name string) {
configMu.Lock()
defer configMu.Unlock()
for i, srv := range config.Servers {
if srv.Name == name {
config.Servers = append(config.Servers[:i], config.Servers[1+i:]...)
return true
return
}
}
return false
}
// FallbackServers returns a slice of server names that