|
@@ -8,6 +8,7 @@ import (
|
|
"math/rand"
|
|
"math/rand"
|
|
"net/url"
|
|
"net/url"
|
|
"sparrow/pkg/server"
|
|
"sparrow/pkg/server"
|
|
|
|
+ "time"
|
|
|
|
|
|
"sync"
|
|
"sync"
|
|
)
|
|
)
|
|
@@ -66,10 +67,10 @@ func initMqttClient(conf *MqttConfig) (mc MQTT.Client, err error) {
|
|
})
|
|
})
|
|
|
|
|
|
mc = MQTT.NewClient(opts)
|
|
mc = MQTT.NewClient(opts)
|
|
- //if errF := mc.Connect().WaitTimeout(time.Second * 5); errF == false {
|
|
|
|
- // server.Log.Errorf("connected failed")
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
|
|
+ if errF := mc.Connect().WaitTimeout(time.Second * 5); errF == false {
|
|
|
|
+ server.Log.Errorf("connected failed")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|