chore: skip websocket client if net isn't up or time sync hasn't complete

This commit is contained in:
Siyuan Miao
2025-04-03 18:16:41 +02:00
parent 65e4a58ad9
commit 1e9adf81d4
3 changed files with 57 additions and 10 deletions

View File

@@ -72,11 +72,9 @@ func Main() {
if config.TLSMode != "" {
go RunWebSecureServer()
}
// If the cloud token isn't set, the client won't be started by default.
// However, if the user adopts the device via the web interface, handleCloudRegister will start the client.
if config.CloudToken != "" {
go RunWebsocketClient()
}
// As websocket client already checks if the cloud token is set, we can start it here.
go RunWebsocketClient()
initSerialPort()
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)