Skip to content

Commit

Permalink
Publishing freeze on connection lost was fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
panter-dsd committed Jul 1, 2019
1 parent 0d81c29 commit 1036534
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client.go
Expand Up @@ -599,7 +599,11 @@ func (c *client) Publish(topic string, qos byte, retained bool, payload interfac
DEBUG.Println(CLI, "storing publish message (reconnecting), topic:", topic)
} else {
DEBUG.Println(CLI, "sending publish message, topic:", topic)
c.obound <- &PacketAndToken{p: pub, t: token}
select {
case c.obound <- &PacketAndToken{p: pub, t: token}:
case <-time.After(c.options.WriteTimeout):
token.setError(errors.New("publish was broken by timeout"))
}
}
return token
}
Expand Down

0 comments on commit 1036534

Please sign in to comment.