v2.7.2
This commit is contained in:
parent
fabe1fa245
commit
74411707e7
@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ type process struct {
|
|||||||
apiPort int
|
apiPort int
|
||||||
|
|
||||||
onlineClients []string
|
onlineClients []string
|
||||||
|
mutex sync.RWMutex
|
||||||
|
|
||||||
config *Config
|
config *Config
|
||||||
logWriter *LogWriter
|
logWriter *LogWriter
|
||||||
@ -152,11 +154,17 @@ func (p *Process) GetConfig() *Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) GetOnlineClients() []string {
|
func (p *Process) GetOnlineClients() []string {
|
||||||
return p.onlineClients
|
p.mutex.RLock()
|
||||||
|
defer p.mutex.RUnlock()
|
||||||
|
clientsCopy := make([]string, len(p.onlineClients))
|
||||||
|
copy(clientsCopy, p.onlineClients)
|
||||||
|
return clientsCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) SetOnlineClients(users []string) {
|
func (p *Process) SetOnlineClients(clients []string) {
|
||||||
p.onlineClients = users
|
p.mutex.Lock()
|
||||||
|
defer p.mutex.Unlock()
|
||||||
|
p.onlineClients = clients
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) GetUptime() uint64 {
|
func (p *Process) GetUptime() uint64 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user