-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathapp_install_state.go
More file actions
47 lines (39 loc) · 715 Bytes
/
Copy pathapp_install_state.go
File metadata and controls
47 lines (39 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"sync"
"golang.org/x/crypto/ssh"
)
type installSession struct {
deviceID string
targetPartition int
version string
mode string
mu sync.Mutex
connLost bool
resume chan *ssh.Client
}
func (a *App) beginInstall() bool {
a.mu.Lock()
defer a.mu.Unlock()
if a.installActive {
return false
}
a.installActive = true
return true
}
func (a *App) endInstall() {
a.mu.Lock()
a.installActive = false
a.installSession = nil
a.mu.Unlock()
}
func (a *App) isInstallActive() bool {
a.mu.Lock()
defer a.mu.Unlock()
return a.installActive
}
func (a *App) setInstallSession(s *installSession) {
a.mu.Lock()
a.installSession = s
a.mu.Unlock()
}