mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 13:52: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) {
|
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
|
userCount := 0
|
||||||
|
|
||||||
// Get requested stream
|
// Get all substreams
|
||||||
stream, ok := streams[name]
|
for _, outputType := range []string{"", "@720p", "@480p", "@360p", "@240p", "@text"} {
|
||||||
if ok {
|
// Get requested stream
|
||||||
// Get number of output channels
|
stream, ok := streams[name+outputType]
|
||||||
userCount = stream.ClientCount()
|
if ok {
|
||||||
|
// Get number of output channels
|
||||||
|
userCount += stream.ClientCount()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display connected users statistics
|
// Display connected users statistics
|
||||||
|
Loading…
Reference in New Issue
Block a user