Remove SessionCDs out of SMGSession

This commit is contained in:
DanB
2017-05-12 18:43:01 +02:00
parent 18376e161e
commit 336b41dd1a
2 changed files with 7 additions and 9 deletions

View File

@@ -32,14 +32,13 @@ import (
// One session handled by SM
type SMGSession struct {
mux sync.RWMutex // protects the SMGSession in places where is concurrently accessed
CGRID string // Unique identifier for this session
EventStart SMGenericEvent // Event which started
stopDebit chan struct{} // Channel to communicate with debit loops when closing the session
RunID string // Keep a reference for the derived run
mux sync.RWMutex // protects the SMGSession in places where is concurrently accessed
stopDebit chan struct{} // Channel to communicate with debit loops when closing the session
CGRID string // Unique identifier for this session
RunID string // Keep a reference for the derived run
Timezone string
CD *engine.CallDescriptor
SessionCDs []*engine.CallDescriptor
EventStart SMGenericEvent // Event which started the session
CD *engine.CallDescriptor // initial CD used for debits, updated on each debit
CallCosts []*engine.CallCost
ExtraDuration time.Duration // keeps the current duration debited on top of what heas been asked
LastUsage time.Duration // last requested Duration
@@ -134,7 +133,6 @@ func (self *SMGSession) debit(dur time.Duration, lastUsed *time.Duration) (time.
self.CD.DurationIndex += ccDuration
self.CD.MaxCostSoFar += cc.Cost
self.CD.LoopIndex += 1
self.SessionCDs = append(self.SessionCDs, self.CD.Clone())
self.CallCosts = append(self.CallCosts, cc)
self.LastDebit = initialExtraDuration + ccDuration
self.TotalUsage += self.LastUsage

View File

@@ -137,7 +137,7 @@ func TestSMGRplcInitiate(t *testing.T) {
} else if len(pSessions) != 1 {
t.Errorf("PassiveSessions: %+v", pSessions)
} else if pSessions[0].Usage != time.Duration(90*time.Second) {
t.Errorf("PassiveSession: %+v", aSessions[0])
t.Errorf("PassiveSession: %+v", pSessions[0])
}
}