From 973fb2cb53aed60e7517c88a1d29da32180fe9c5 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 27 Apr 2018 16:22:23 +0900 Subject: [PATCH] ing --- socket/net/client/connector.go | 7 +++++-- socket/web/client/connector.go | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/socket/net/client/connector.go b/socket/net/client/connector.go index 7d0fbfd..700a1ca 100644 --- a/socket/net/client/connector.go +++ b/socket/net/client/connector.go @@ -64,8 +64,9 @@ func (c *Connectors) Connect() (readChan <-chan []byte, writeChan chan<- []byte, c.crw.DisconnectedChan = c.disconnectedChan c.crw.ReconnectedChan = c.reconnectedChan - c.stopWg.Add(2) + c.stopWg.Add(1) go c.handleReconnect() + c.stopWg.Add(1) go c.crw.HandleConnection(conn) return c.readChan, c.writeChan, nil @@ -95,7 +96,9 @@ func (c *Connectors) onDisconnected() { onDisconnected := c.OnDisconnected if nil != onDisconnected { - onDisconnected(c) + go func() { + onDisconnected(c) + }() } } diff --git a/socket/web/client/connector.go b/socket/web/client/connector.go index edadcf1..800cc9a 100644 --- a/socket/web/client/connector.go +++ b/socket/web/client/connector.go @@ -101,8 +101,9 @@ func (c *Connectors) Connect() (readChan <-chan []byte, writeChan chan<- []byte, c.crw.DisconnectedChan = c.disconnectedChan c.crw.ReconnectedChan = c.reconnectedChan - c.stopWg.Add(2) + c.stopWg.Add(1) go c.handleReconnect() + c.stopWg.Add(1) go c.crw.HandleConnection(conn) return c.readChan, c.writeChan, nil @@ -132,7 +133,9 @@ func (c *Connectors) onDisconnected() { onDisconnected := c.OnDisconnected if nil != onDisconnected { - onDisconnected(c) + go func() { + onDisconnected(c) + }() } }