MCPcopy Create free account
hub / github.com/Threadfin/Threadfin / cleanUpStaleClients

Function cleanUpStaleClients

src/buffer.go:76–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74}
75
76func cleanUpStaleClients() {
77 BufferInformation.Range(func(key, value interface{}) bool {
78 playlist, ok := value.(Playlist)
79 if !ok {
80 fmt.Printf("Invalid type assertion for playlist: %v\n", value)
81 return true
82 }
83
84 for clientID, client := range playlist.Clients {
85 if client.Connection <= 0 {
86 fmt.Printf("Removing stale client ID %d from playlist %s\n", clientID, playlist.PlaylistID)
87 delete(playlist.Clients, clientID)
88 }
89 }
90 BufferInformation.Store(key, playlist)
91 return true
92 })
93}
94
95func getClientIP(r *http.Request) string {
96 // Check the X-Forwarded-For header first

Callers 1

getActiveClientCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected