(hub *Hub)
| 566 | } |
| 567 | |
| 568 | func (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, ¤tUA, 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. |
| 621 | func (t *Topic) handleClientMsg(msg *ClientComMessage) { |
no test coverage detected