Skip to content

Commit

Permalink
Merge pull request #1430 from openziti/fix-router-connect-panic
Browse files Browse the repository at this point in the history
Fix panic when router version info isn't set by ensuring it is set and making sure we get the right version. Fixes #1423
  • Loading branch information
plorenz authored Oct 12, 2023
2 parents 1678b87 + 3523b34 commit 5695bdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions controller/handler_ctrl/accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package handler_ctrl
import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/channel/v2"
"github.com/openziti/ziti/common/pb/ctrl_pb"
"github.com/openziti/ziti/controller/network"
"github.com/openziti/ziti/controller/xctrl"
"github.com/openziti/ziti/common/pb/ctrl_pb"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"time"
Expand Down Expand Up @@ -101,7 +101,7 @@ func (self *CtrlAccepter) Bind(binding channel.Binding) error {
r.SetMetadata(routerMetadata)
}
} else {
log.Warn("no attributes provided")
return errors.New("no version info header, closing router connection")
}

r.Control = ch
Expand Down
6 changes: 3 additions & 3 deletions controller/handler_edge_ctrl/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func (h *helloHandler) HandleReceive(msg *channel.Message, ch channel.Channel) {
return
}

r, err := h.appEnv.GetHostController().GetNetwork().GetRouter(ch.Id())
if err != nil {
pfxlog.Logger().WithError(err).Errorf("could not find router %v, closing channel", ch.Id())
r := h.appEnv.GetHostController().GetNetwork().GetConnectedRouter(ch.Id())
if r == nil {
pfxlog.Logger().Errorf("could not find router %v, closing channel", ch.Id())
_ = ch.Close()
return
}
Expand Down

0 comments on commit 5695bdb

Please sign in to comment.