Skip to content

Commit cd4337d

Browse files
committed
run errorWatch as part of the waitgroup
1 parent 0a1518b commit cd4337d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Diff for: client.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,8 @@ func (c *client) Connect() Token {
264264
c.persist.Reset()
265265
}
266266

267+
c.workers.Add(4)
267268
go errorWatch(c)
268-
269-
// Do not start incoming until resume has completed
270-
c.workers.Add(3)
271269
go alllogic(c)
272270
go outgoing(c)
273271
go incoming(c)
@@ -359,9 +357,8 @@ func (c *client) reconnect() {
359357
go c.options.OnConnect(c)
360358
}
361359

360+
c.workers.Add(4)
362361
go errorWatch(c)
363-
364-
c.workers.Add(3)
365362
go alllogic(c)
366363
go outgoing(c)
367364
go incoming(c)

Diff for: net.go

+1
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ func alllogic(c *client) {
320320
}
321321

322322
func errorWatch(c *client) {
323+
defer c.workers.Done()
323324
select {
324325
case <-c.stop:
325326
WARN.Println(NET, "errorWatch stopped")

0 commit comments

Comments
 (0)