Skip to content

Commit

Permalink
Fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Apr 11, 2018
1 parent cd82b49 commit 0baa1da
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/input/reader/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,11 @@ func (m *MQTT) msgHandler(c mqtt.Client, msg mqtt.Message) {

// Read attempts to read a new message from an MQTT broker.
func (m *MQTT) Read() (types.Message, error) {
if m.client == nil {
return nil, types.ErrNotConnected
}

select {
case msg := <-m.msgChan:
return types.NewMessage([][]byte{[]byte(msg.Payload())}), nil
case <-m.interruptChan:
}

return nil, types.ErrTypeClosed
}

Expand Down

0 comments on commit 0baa1da

Please sign in to comment.