MCPcopy
hub / github.com/livekit/livekit / Stop

Method Stop

pkg/service/server.go:352–373  ·  view source on GitHub ↗
(force bool)

Source from the content-addressed store, hash-verified

350}
351
352func (s *LivekitServer) Stop(force bool) {
353 // wait for all participants to exit
354 s.router.Drain()
355 partTicker := time.NewTicker(5 * time.Second)
356 waitingForParticipants := !force && s.roomManager.HasParticipants()
357 for waitingForParticipants {
358 <-partTicker.C
359 logger.Infow("waiting for participants to exit")
360 waitingForParticipants = s.roomManager.HasParticipants()
361 }
362 partTicker.Stop()
363
364 if !s.running.Swap(false) {
365 return
366 }
367
368 s.router.Stop()
369 close(s.doneChan)
370
371 // wait for fully closed
372 <-s.closedChan
373}
374
375func (s *LivekitServer) RoomManager() *RoomManager {
376 return s.roomManager

Callers 1

StartMethod · 0.95

Calls 4

HasParticipantsMethod · 0.80
DrainMethod · 0.65
StopMethod · 0.65
SwapMethod · 0.45

Tested by

no test coverage detected