Create atomic string to allow for simpler logic

This commit is contained in:
Dane Everitt
2020-11-06 21:14:29 -08:00
parent a74be8f4eb
commit 3fce1b98d5
6 changed files with 62 additions and 41 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/pterodactyl/wings/api"
"github.com/pterodactyl/wings/environment"
"github.com/pterodactyl/wings/events"
"github.com/pterodactyl/wings/system"
"io"
"sync"
)
@@ -47,8 +48,7 @@ type Environment struct {
emitter *events.EventBus
// Tracks the environment state.
st string
stMu sync.RWMutex
State system.AtomicString
}
// Creates a new base Docker environment. The ID passed through will be the ID that is used to
@@ -65,9 +65,10 @@ func New(id string, m *Metadata, c *environment.Configuration) (*Environment, er
Configuration: c,
meta: m,
client: cli,
st: environment.ProcessOfflineState,
}
e.State.Store(environment.ProcessOfflineState)
return e, nil
}