Skip to content

Commit 8b638fb

Browse files
author
Daniele Vasselli
committed
Remove the channel draining since it is not reused.
Signed-off-by Daniele Vasselli <[email protected]>
1 parent d0120ee commit 8b638fb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

client.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,12 +799,10 @@ func (c *client) Publish(topic string, qos byte, retained bool, payload interfac
799799
if publishWaitTimeout == 0 {
800800
publishWaitTimeout = time.Second * 30
801801
}
802+
802803
t := time.NewTimer(publishWaitTimeout)
803-
defer func() {
804-
if !t.Stop() {
805-
<-t.C
806-
}
807-
}()
804+
defer t.Stop()
805+
808806
select {
809807
case c.obound <- &PacketAndToken{p: pub, t: token}:
810808
case <-t.C:

0 commit comments

Comments
 (0)