From 003682366c128f1e0c6464836cfa0d3c7d418b10 Mon Sep 17 00:00:00 2001 From: haidy Date: Sun, 24 Mar 2019 09:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B4=A9=E6=BA=83=E7=9A=84bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/control.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/control.go b/client/control.go index 409f7941..991145b5 100644 --- a/client/control.go +++ b/client/control.go @@ -298,11 +298,18 @@ func (ctl *Control) worker() { case <-ctl.closedCh: // close related channels and wait until other goroutines done close(ctl.readCh) - ctl.readerShutdown.WaitDone() - ctl.msgHandlerShutdown.WaitDone() + if ctl.readerShutdown != nil { + ctl.readerShutdown.WaitDone() + } + + if ctl.msgHandlerShutdown != nil { + ctl.msgHandlerShutdown.WaitDone() + } close(ctl.sendCh) - ctl.writerShutdown.WaitDone() + if ctl.writerShutdown != nil { + ctl.writerShutdown.WaitDone() + } ctl.pm.Close() ctl.vm.Close()