Skip to content

Commit

Permalink
update cluster sub
Browse files Browse the repository at this point in the history
  • Loading branch information
孙飞 authored and 孙飞 committed Apr 3, 2019
1 parent 50b4e9c commit ca3e175
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions broker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package broker
import (
"bufio"
"errors"
"fmt"
"net"
"sync/atomic"
"time"
Expand Down Expand Up @@ -58,6 +59,7 @@ func (c *client) process() {
c.bk.Unlock()

c.closed = true
c.closech <- struct{}{}
c.conn.Close()
g.L.Debug("client closed", zap.Uint64("conn_id", c.id))
}()
Expand Down Expand Up @@ -142,6 +144,7 @@ func (c *client) onSubscribe(topic []byte) error {
func (c *client) sendLoop() {
defer func() {
// when disconnect, automaticly unsubscribe the topic
fmt.Println("here1111:", c.subs)
for tid := range c.subs {
c.bk.cluster.Unsubscribe(tid, c.id)
}
Expand Down

0 comments on commit ca3e175

Please sign in to comment.