Use Drain() to unsuscribe or close connection

This commit is contained in:
magodo 2019-05-15 11:05:29 +08:00 committed by Vasiliy Tolstov
parent 29bf388131
commit e2254ba411

View File

@ -56,7 +56,7 @@ func (n *subscriber) Topic() string {
} }
func (n *subscriber) Unsubscribe() error { func (n *subscriber) Unsubscribe() error {
return n.s.Unsubscribe() return n.s.Drain()
} }
func (n *nbroker) Address() string { func (n *nbroker) Address() string {
@ -121,7 +121,7 @@ func (n *nbroker) Connect() error {
func (n *nbroker) Disconnect() error { func (n *nbroker) Disconnect() error {
n.RLock() n.RLock()
n.conn.Close() n.conn.Drain()
n.RUnlock() n.RUnlock()
return nil return nil
} }