Browse Source

TUN-5530: Get current time from ticker

pull/561/head
cthuang 5 months ago
parent
commit
9251b3aa1f
  1. 5
      datagramsession/session.go

5
datagramsession/session.go

@ -77,9 +77,10 @@ func (s *Session) waitForCloseCondition(ctx context.Context, closeAfterIdle time
return
case <-s.doneChan:
return
case <-checkIdleTicker.C:
// TODO: TUN-5423 evaluate if using atomic is more efficient
case now := <-checkIdleTicker.C:
// The session is considered inactive if current time is after (last active time + allowed idle time)
if time.Now().After(activeAt.Add(closeAfterIdle)) {
if now.After(activeAt.Add(closeAfterIdle)) {
return
}
case activeAt = <-s.activeAtChan: // Update last active time

Loading…
Cancel
Save