mirror of https://github.com/jetkvm/kvm.git
fix conflicts
This commit is contained in:
parent
50d4374a26
commit
a9a8df5d9c
6
cloud.go
6
cloud.go
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/coder/websocket/wsjson"
|
||||
|
@ -121,6 +122,11 @@ var (
|
|||
)
|
||||
)
|
||||
|
||||
var (
|
||||
cloudDisconnectChan chan error
|
||||
cloudDisconnectLock = &sync.Mutex{}
|
||||
)
|
||||
|
||||
func wsResetMetrics(established bool, sourceType string, source string) {
|
||||
metricConnectionLastPingTimestamp.WithLabelValues(sourceType, source).Set(-1)
|
||||
metricConnectionLastPingDuration.WithLabelValues(sourceType, source).Set(-1)
|
||||
|
|
18
web.go
18
web.go
|
@ -207,6 +207,24 @@ func handleWebRTCSignalWsMessages(wsCon *websocket.Conn, isCloudConnection bool,
|
|||
}
|
||||
}()
|
||||
|
||||
if isCloudConnection {
|
||||
// create a channel to receive the disconnect event, once received, we cancelRun
|
||||
cloudDisconnectChan = make(chan error)
|
||||
defer func() {
|
||||
close(cloudDisconnectChan)
|
||||
cloudDisconnectChan = nil
|
||||
}()
|
||||
go func() {
|
||||
for err := range cloudDisconnectChan {
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
cloudLogger.Infof("disconnecting from cloud due to: %v", err)
|
||||
cancelRun()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
for {
|
||||
typ, msg, err := wsCon.Read(runCtx)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue