MCPcopy Create free account
hub / github.com/Hidden-Node/GooseRelayVPN-AndroidClient / gcDoneSessions

Method gcDoneSessions

internal/exit/exit.go:783–809  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

781}
782
783func (s *Server) gcDoneSessions() {
784 s.mu.Lock()
785 defer s.mu.Unlock()
786 for id, sess := range s.sessions {
787 if sess.IsDone() {
788 sess.Stop()
789 delete(s.sessions, id)
790 delete(s.sessionOwners, id)
791 delete(s.txReady, id)
792 delete(s.firstReply, id)
793 delete(s.upstreams, id)
794 delete(s.lastActivity, id)
795 s.stats.sessionsClose.Add(1)
796 }
797 }
798 // Clean up activity channels for clients that have no active sessions.
799 // Prevents unbounded map growth when clients connect/disconnect repeatedly.
800 activeOwners := make(map[[frame.ClientIDLen]byte]struct{}, len(s.sessions))
801 for _, owner := range s.sessionOwners {
802 activeOwners[owner] = struct{}{}
803 }
804 for owner := range s.activity {
805 if _, stillActive := activeOwners[owner]; !stillActive {
806 delete(s.activity, owner)
807 }
808 }
809}
810
811// gcIdleSessions force-closes sessions that haven't seen any client-side
812// activity (incoming frame) for longer than idleSessionTimeout. This is the

Callers 1

handleTunnelMethod · 0.95

Calls 2

IsDoneMethod · 0.80
StopMethod · 0.45

Tested by

no test coverage detected