Download this file
| 1 | package hub |
| 2 | |
| 3 | // AdmittedCount is how many participations are admitted in the room — |
| 4 | // the one number the drive surface reads back out of a live meeting |
| 5 | // (spec §8.2: the count of admitted peers, never their names or the |
| 6 | // chat). A room nobody has opened answers zero, which is what a |
| 7 | // meeting with no room actually means; the caller already knows the |
| 8 | // meeting exists, so there is nothing to distinguish. |
| 9 | // |
| 10 | // Taken under the hub's own lock, like every other reader, and built |
| 11 | // on admittedCountLocked so the API and the mesh cap can never |
| 12 | // disagree about what "admitted" counts. |
| 13 | func (h *Hub) AdmittedCount(sqid string) int { |
| 14 | h.mu.Lock() |
| 15 | defer h.mu.Unlock() |
| 16 | r, ok := h.rooms[sqid] |
| 17 | if !ok { |
| 18 | return 0 |
| 19 | } |
| 20 | return admittedCountLocked(r) |
| 21 | } |
| 22 | |