()
| 74 | } |
| 75 | |
| 76 | func 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 | |
| 95 | func getClientIP(r *http.Request) string { |
| 96 | // Check the X-Forwarded-For header first |
no outgoing calls
no test coverage detected