MCPcopy Index your code
hub / github.com/tinode/chat / runLocal

Method runLocal

server/topic.go:568–618  ·  view source on GitHub ↗
(hub *Hub)

Source from the content-addressed store, hash-verified

566}
567
568func (t *Topic) runLocal(hub *Hub) {
569 // Kills topic after a period of inactivity.
570 t.killTimer = time.NewTimer(time.Hour)
571 t.killTimer.Stop()
572
573 // Notifies about user agent change. 'me' only
574 uaTimer := time.NewTimer(time.Minute)
575 var currentUA string
576 uaTimer.Stop()
577
578 // Ticker for deferred presence notifications.
579 defrNotifTimer := time.NewTimer(time.Millisecond * 500)
580
581 t.callEstablishmentTimer = time.NewTimer(time.Second)
582 t.callEstablishmentTimer.Stop()
583
584 for {
585 select {
586 case msg := <-t.reg:
587 t.registerSession(msg)
588
589 case msg := <-t.unreg:
590 t.unregisterSession(msg)
591
592 case msg := <-t.clientMsg:
593 t.handleClientMsg(msg)
594
595 case msg := <-t.serverMsg:
596 t.handleServerMsg(msg)
597
598 case meta := <-t.meta:
599 t.handleMeta(meta)
600
601 case upd := <-t.supd:
602 t.handleSessionUpdate(upd, &currentUA, uaTimer)
603
604 case <-uaTimer.C:
605 t.handleUATimerEvent(currentUA)
606
607 case <-t.killTimer.C:
608 t.handleTopicTimeout(hub, currentUA, uaTimer, defrNotifTimer)
609
610 case <-t.callEstablishmentTimer.C:
611 t.terminateCallInProgress(true)
612
613 case sd := <-t.exit:
614 t.handleTopicTermination(sd)
615 return
616 }
617 }
618}
619
620// handleClientMsg is the top-level handler of messages received by the topic from sessions.
621func (t *Topic) handleClientMsg(msg *ClientComMessage) {

Callers 1

runMethod · 0.95

Calls 11

registerSessionMethod · 0.95
unregisterSessionMethod · 0.95
handleClientMsgMethod · 0.95
handleServerMsgMethod · 0.95
handleMetaMethod · 0.95
handleSessionUpdateMethod · 0.95
handleUATimerEventMethod · 0.95
handleTopicTimeoutMethod · 0.95
StopMethod · 0.65

Tested by

no test coverage detected