Bail out on samechannel gateway when a bridge fails to start

This commit is contained in:
Wim 2016-10-03 09:22:59 +02:00
parent 9ca4fe7a5e
commit 2d6ed51d94
2 changed files with 5 additions and 2 deletions

View File

@ -38,7 +38,7 @@ func New(cfg *config.Config, gateway *config.Gateway) error {
for _, br := range gw.Bridges { for _, br := range gw.Bridges {
err := br.Connect() err := br.Connect()
if err != nil { if err != nil {
log.Fatalf("Bridge %s failed to start. Exiting", br.FullOrigin()) log.Fatalf("Bridge %s failed to start: %v", br.FullOrigin(), err)
} }
for _, channel := range append(gw.ChannelsOut[br.FullOrigin()], gw.ChannelsIn[br.FullOrigin()]...) { for _, channel := range append(gw.ChannelsOut[br.FullOrigin()], gw.ChannelsIn[br.FullOrigin()]...) {
if exists[br.FullOrigin()+channel] { if exists[br.FullOrigin()+channel] {

View File

@ -29,7 +29,10 @@ func New(cfg *config.Config, gateway *config.SameChannelGateway) error {
gw.Bridges = append(gw.Bridges, bridge.New(cfg, &br, c)) gw.Bridges = append(gw.Bridges, bridge.New(cfg, &br, c))
} }
for _, br := range gw.Bridges { for _, br := range gw.Bridges {
br.Connect() err := br.Connect()
if err != nil {
log.Fatalf("Bridge %s failed to start: %v", br.FullOrigin(), err)
}
for _, channel := range gw.Channels { for _, channel := range gw.Channels {
log.Infof("%s: joining %s", br.FullOrigin(), channel) log.Infof("%s: joining %s", br.FullOrigin(), channel)
br.JoinChannel(channel) br.JoinChannel(channel)