From 208a7cf0a8d5f5dec91c4afd44f68b232d7ac852 Mon Sep 17 00:00:00 2001 From: zhouyuyan Date: Thu, 26 Oct 2017 16:11:01 +0800 Subject: [PATCH] wait for message when close connection --- broker/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/broker/client.go b/broker/client.go index 087ad01..c9966bb 100644 --- a/broker/client.go +++ b/broker/client.go @@ -470,6 +470,8 @@ func (c *client) Close() { if c.status == Disconnected { return } + //wait for message complete + time.Sleep(time.Second) c.smu.Lock() c.status = Disconnected