(topic string, sub *Subscription)
| 177 | } |
| 178 | |
| 179 | func (s *Session) addSub(topic string, sub *Subscription) { |
| 180 | if s.multi != nil { |
| 181 | s.multi.addSub(topic, sub) |
| 182 | return |
| 183 | } |
| 184 | s.subsLock.Lock() |
| 185 | |
| 186 | // Sessions that serve as an interface between proxy topics and their masters (proxy sessions) |
| 187 | // may have only one subscription, that is, to its master topic. |
| 188 | // Normal sessions may be subscribed to multiple topics. |
| 189 | |
| 190 | if !s.isMultiplex() || s.countSub() == 0 { |
| 191 | s.subs[topic] = sub |
| 192 | } |
| 193 | s.subsLock.Unlock() |
| 194 | } |
| 195 | |
| 196 | func (s *Session) getSub(topic string) *Subscription { |
| 197 | // Don't check s.multi here. Let it panic if called for proxy session. |
no test coverage detected