MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / timeoutLoop

Method timeoutLoop

server-source-code/internal/rdpproxy/session.go:265–283  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

263}
264
265func (s *Session) timeoutLoop(ctx context.Context) {
266 ticker := time.NewTicker(30 * time.Second)
267 defer ticker.Stop()
268 for {
269 select {
270 case <-ctx.Done():
271 return
272 case <-ticker.C:
273 last := time.Unix(0, s.lastActivity.Load())
274 if time.Since(last) > sessionIdleTimeout {
275 if s.log != nil {
276 s.log.Info("rdp proxy session idle timeout", "session_id", s.SessionID)
277 }
278 s.cleanup()
279 return
280 }
281 }
282 }
283}
284
285func (s *Session) cleanup() {
286 s.cleanupOnce.Do(func() {

Callers 1

CreateMethod · 0.95

Calls 2

cleanupMethod · 0.95
StopMethod · 0.45

Tested by

no test coverage detected