File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -384,14 +384,14 @@ func (c *Client) internalConnLost(err error) {
384
384
385
385
func (c * Client ) disconnect () {
386
386
select {
387
- case _ , ok := <- c .stop :
388
- if ok {
389
- close ( c . stop )
390
- }
387
+ case <- c .stop :
388
+ //someone else has already closed the channel, must be error
389
+ default :
390
+ close ( c . stop )
391
391
}
392
- //Wait for all workers to finish before closing connection
393
- c .workers .Wait ()
394
392
c .conn .Close ()
393
+ c .workers .Wait ()
394
+ close (c .stopRouter )
395
395
DEBUG .Println (CLI , "disconnected" )
396
396
c .persist .Close ()
397
397
}
Original file line number Diff line number Diff line change @@ -16,14 +16,22 @@ package mqtt
16
16
17
17
import (
18
18
"log"
19
+ "net/http"
19
20
"os"
20
21
"testing"
22
+
23
+ _ "net/http/pprof"
21
24
)
22
25
23
26
func init () {
24
27
DEBUG = log .New (os .Stderr , "DEBUG " , log .Ltime )
25
28
WARN = log .New (os .Stderr , "WARNING " , log .Ltime )
26
29
CRITICAL = log .New (os .Stderr , "CRITICAL " , log .Ltime )
30
+ ERROR = log .New (os .Stderr , "ERROR " , log .Ltime )
31
+
32
+ go func () {
33
+ log .Println (http .ListenAndServe ("localhost:6060" , nil ))
34
+ }()
27
35
}
28
36
29
37
func Test_NewClient_simple (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments