From 9c381a449dbe961eb688569fc0fa8ea7a5344081 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Mon, 8 Apr 2019 11:44:57 +0300 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- modules/api_rest/api_rest_controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/api_rest/api_rest_controller.go b/modules/api_rest/api_rest_controller.go index da9b4d63..f1f17411 100644 --- a/modules/api_rest/api_rest_controller.go +++ b/modules/api_rest/api_rest_controller.go @@ -95,7 +95,7 @@ func (mod *RestAPI) patchFrame(buf []byte) (frame map[string]interface{}, err er func (mod *RestAPI) showSession(w http.ResponseWriter, r *http.Request) { if mod.replaying { if !mod.record.Session.Over() { - from := mod.record.Session.CurFrame() - 1 + from := mod.record.Session.Index() - 1 q := r.URL.Query() vals := q["from"] if len(vals) > 0 { @@ -106,12 +106,12 @@ func (mod *RestAPI) showSession(w http.ResponseWriter, r *http.Request) { mod.record.Session.SetFrom(from) mod.Debug("replaying session %d of %d from %s", - mod.record.Session.CurFrame(), + mod.record.Session.Index(), mod.record.Session.Frames(), mod.recordFileName) mod.State.Store("rec_frames", mod.record.Session.Frames()) - mod.State.Store("rec_cur_frame", mod.record.Session.CurFrame()) + mod.State.Store("rec_cur_frame", mod.record.Session.Index()) buf := mod.record.Session.Next() if frame, err := mod.patchFrame(buf); err != nil { @@ -254,7 +254,7 @@ func (mod *RestAPI) showEvents(w http.ResponseWriter, r *http.Request) { if mod.replaying { if !mod.record.Events.Over() { - from := mod.record.Events.CurFrame() - 1 + from := mod.record.Events.Index() - 1 vals := q["from"] if len(vals) > 0 { if n, err := strconv.Atoi(vals[0]); err == nil { @@ -264,7 +264,7 @@ func (mod *RestAPI) showEvents(w http.ResponseWriter, r *http.Request) { mod.record.Events.SetFrom(from) mod.Debug("replaying events %d of %d from %s", - mod.record.Events.CurFrame(), + mod.record.Events.Index(), mod.record.Events.Frames(), mod.recordFileName)