implement fallback (#104)

This commit is contained in:
aler9 2020-11-01 17:48:00 +01:00
parent bbc2401ac2
commit 655e0d0fd6
4 changed files with 60 additions and 0 deletions

View file

@ -612,6 +612,13 @@ func (pa *Path) onClientDescribe(c *client.Client) {
return
case sourceStateNotReady:
if pa.conf.Fallback != "" {
pa.addClient(c, clientStatePreRemove)
pa.removeClient(c)
c.OnPathDescribeData(nil, pa.conf.Fallback, nil)
return
}
pa.addClient(c, clientStatePreRemove)
pa.removeClient(c)
c.OnPathDescribeData(nil, "", fmt.Errorf("no one is publishing to path '%s'", pa.name))