move mutex
This commit is contained in:
parent
4942e00007
commit
327e795e49
4
conn.go
4
conn.go
@ -279,6 +279,8 @@ func (c *Client) internalConnect(mock net.Conn) error {
|
||||
var ctx context.Context
|
||||
ctx, c.stop = context.WithCancel(context.Background())
|
||||
|
||||
c.mu.Unlock()
|
||||
|
||||
// Start read loop to process messages from the server.
|
||||
errs := make(chan error, 3)
|
||||
done := make(chan struct{}, 4)
|
||||
@ -297,8 +299,6 @@ func (c *Client) internalConnect(mock net.Conn) error {
|
||||
go c.pingLoop(errs, done, &wg, 1*time.Second)
|
||||
}
|
||||
|
||||
c.mu.Unlock()
|
||||
|
||||
// Send a virtual event allowing hooks for successful socket connection.
|
||||
c.RunHandlers(&Event{Command: INITIALIZED, Trailing: c.Server()})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user