FIXME: this won't work correctly with multiplexing sessions.
()
| 3682 | |
| 3683 | // FIXME: this won't work correctly with multiplexing sessions. |
| 3684 | func (t *Topic) mostRecentSession() *Session { |
| 3685 | var sess *Session |
| 3686 | var latest int64 |
| 3687 | for s := range t.sessions { |
| 3688 | sessionLastAction := atomic.LoadInt64(&s.lastAction) |
| 3689 | if sessionLastAction > latest { |
| 3690 | sess = s |
| 3691 | latest = sessionLastAction |
| 3692 | } |
| 3693 | } |
| 3694 | return sess |
| 3695 | } |
| 3696 | |
| 3697 | const ( |
| 3698 | // Topic is fully initialized. |