mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 10:22:19 +00:00
Sum all user counts for each substream to have the total number of clients that are connected to a stream
This commit is contained in:
parent
37b5106c4e
commit
b5aac93c97
@ -150,14 +150,17 @@ func staticHandler() http.Handler {
|
||||
}
|
||||
|
||||
func statisticsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
name := strings.Replace(r.URL.Path[7:], "/", "", -1)
|
||||
name := strings.SplitN(strings.Replace(r.URL.Path[7:], "/", "", -1), "@", 2)[0]
|
||||
userCount := 0
|
||||
|
||||
// Get requested stream
|
||||
stream, ok := streams[name]
|
||||
if ok {
|
||||
// Get number of output channels
|
||||
userCount = stream.ClientCount()
|
||||
// Get all substreams
|
||||
for _, outputType := range []string{"", "@720p", "@480p", "@360p", "@240p", "@text"} {
|
||||
// Get requested stream
|
||||
stream, ok := streams[name+outputType]
|
||||
if ok {
|
||||
// Get number of output channels
|
||||
userCount += stream.ClientCount()
|
||||
}
|
||||
}
|
||||
|
||||
// Display connected users statistics
|
||||
|
Loading…
Reference in New Issue
Block a user