ing
This commit is contained in:
parent
d786bc3281
commit
973fb2cb53
|
@ -64,8 +64,9 @@ func (c *Connectors) Connect() (readChan <-chan []byte, writeChan chan<- []byte,
|
||||||
c.crw.DisconnectedChan = c.disconnectedChan
|
c.crw.DisconnectedChan = c.disconnectedChan
|
||||||
c.crw.ReconnectedChan = c.reconnectedChan
|
c.crw.ReconnectedChan = c.reconnectedChan
|
||||||
|
|
||||||
c.stopWg.Add(2)
|
c.stopWg.Add(1)
|
||||||
go c.handleReconnect()
|
go c.handleReconnect()
|
||||||
|
c.stopWg.Add(1)
|
||||||
go c.crw.HandleConnection(conn)
|
go c.crw.HandleConnection(conn)
|
||||||
|
|
||||||
return c.readChan, c.writeChan, nil
|
return c.readChan, c.writeChan, nil
|
||||||
|
@ -95,7 +96,9 @@ func (c *Connectors) onDisconnected() {
|
||||||
|
|
||||||
onDisconnected := c.OnDisconnected
|
onDisconnected := c.OnDisconnected
|
||||||
if nil != onDisconnected {
|
if nil != onDisconnected {
|
||||||
onDisconnected(c)
|
go func() {
|
||||||
|
onDisconnected(c)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,9 @@ func (c *Connectors) Connect() (readChan <-chan []byte, writeChan chan<- []byte,
|
||||||
c.crw.DisconnectedChan = c.disconnectedChan
|
c.crw.DisconnectedChan = c.disconnectedChan
|
||||||
c.crw.ReconnectedChan = c.reconnectedChan
|
c.crw.ReconnectedChan = c.reconnectedChan
|
||||||
|
|
||||||
c.stopWg.Add(2)
|
c.stopWg.Add(1)
|
||||||
go c.handleReconnect()
|
go c.handleReconnect()
|
||||||
|
c.stopWg.Add(1)
|
||||||
go c.crw.HandleConnection(conn)
|
go c.crw.HandleConnection(conn)
|
||||||
|
|
||||||
return c.readChan, c.writeChan, nil
|
return c.readChan, c.writeChan, nil
|
||||||
|
@ -132,7 +133,9 @@ func (c *Connectors) onDisconnected() {
|
||||||
|
|
||||||
onDisconnected := c.OnDisconnected
|
onDisconnected := c.OnDisconnected
|
||||||
if nil != onDisconnected {
|
if nil != onDisconnected {
|
||||||
onDisconnected(c)
|
go func() {
|
||||||
|
onDisconnected(c)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user