mirror of https://github.com/jetkvm/kvm.git
Compare commits
3 Commits
06a837171f
...
ac304b3855
Author | SHA1 | Date |
---|---|---|
|
ac304b3855 | |
|
727561738e | |
|
a9767b650c |
5
cloud.go
5
cloud.go
|
@ -68,6 +68,11 @@ func handleCloudRegister(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if config.CloudToken == "" {
|
||||
logger.Info("Starting websocket client due to adoption")
|
||||
go RunWebsocketClient()
|
||||
}
|
||||
|
||||
config.CloudToken = tokenResp.SecretToken
|
||||
config.CloudURL = req.CloudAPI
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -66,7 +66,11 @@ func Main() {
|
|||
}()
|
||||
//go RunFuseServer()
|
||||
go RunWebServer()
|
||||
go RunWebsocketClient()
|
||||
// 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()
|
||||
}
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-sigs
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v4/pkg/media"
|
||||
|
@ -224,6 +225,12 @@ func ExtractAndRunNativeBin() error {
|
|||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
// Set the process group ID so we can kill the process and its children when this process exits
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
Setpgid: true,
|
||||
Pdeathsig: syscall.SIGKILL,
|
||||
}
|
||||
|
||||
// Start the command
|
||||
if err := cmd.Start(); err != nil {
|
||||
return fmt.Errorf("failed to start binary: %w", err)
|
||||
|
|
Loading…
Reference in New Issue