From 9ee69d4cf5558b863fcc4d143caef51b72b7fff7 Mon Sep 17 00:00:00 2001 From: langhuihui <178529795@qq.com> Date: Tue, 15 Jun 2021 22:58:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subscriber.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subscriber.go b/subscriber.go index 33d22da..48bb81d 100644 --- a/subscriber.go +++ b/subscriber.go @@ -30,8 +30,12 @@ type Subscriber struct { } func (s *Subscriber) close() { - s.UnSubscribe(s) - s.cancel() + if s.Stream != nil { + s.UnSubscribe(s) + } + if s.cancel != nil { + s.cancel() + } } // Close 关闭订阅者