Skip to content

Commit

Permalink
return error if backend does not return a session
Browse files Browse the repository at this point in the history
  • Loading branch information
256dpi committed Apr 17, 2018
1 parent 3e4d0e1 commit 0a31556
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions broker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const (
// ConnectPacket.
var ErrExpectedConnect = errors.New("expected a ConnectPacket as the first packet")

// ErrMissingSession is returned if the backend does not return a session.
var ErrMissingSession = errors.New("no session returned from Backend")

// A Client represents a remote client that is connected to the broker.
type Client struct {
state uint32
Expand Down Expand Up @@ -213,6 +216,8 @@ func (c *Client) processConnect(pkt *packet.ConnectPacket) error {
s, resumed, err := c.engine.Backend.Setup(c, pkt.ClientID)
if err != nil {
return c.die(BackendError, err, true)
} else if s == nil {
return c.die(BackendError, ErrMissingSession, true)
}

// reset the session if clean is requested
Expand Down

0 comments on commit 0a31556

Please sign in to comment.