misc: added loading boolean flag to api.rest state object

This commit is contained in:
evilsocket 2019-03-29 18:00:48 +01:00
parent 0a31ac8167
commit a411607a57
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 8 additions and 0 deletions

View file

@ -30,6 +30,7 @@ type RestAPI struct {
recording bool
recTime int
loading bool
replaying bool
recordFileName string
recordWait *sync.WaitGroup
@ -49,6 +50,7 @@ func NewRestAPI(s *session.Session) *RestAPI {
},
recording: false,
recTime: 0,
loading: false,
replaying: false,
recordFileName: "",
recordWait: &sync.WaitGroup{},
@ -57,6 +59,7 @@ func NewRestAPI(s *session.Session) *RestAPI {
mod.State.Store("recording", &mod.recording)
mod.State.Store("replaying", &mod.replaying)
mod.State.Store("loading", &mod.loading)
mod.State.Store("rec_time", &mod.recTime)
mod.State.Store("rec_filename", &mod.recordFileName)
mod.State.Store("rec_frames", 0)

View file

@ -25,6 +25,11 @@ func (mod *RestAPI) startReplay(filename string) (err error) {
return err
}
mod.loading = true
defer func() {
mod.loading = false
}()
mod.Info("loading %s ...", mod.recordFileName)
start := time.Now()