RemoveReactor removes the given Reactor from the Switch. NOTE: Not goroutine safe.
(name string, reactor Reactor)
| 179 | // RemoveReactor removes the given Reactor from the Switch. |
| 180 | // NOTE: Not goroutine safe. |
| 181 | func (sw *Switch) RemoveReactor(name string, reactor Reactor) { |
| 182 | for _, chDesc := range reactor.GetChannels() { |
| 183 | // remove channel description |
| 184 | for i := 0; i < len(sw.chDescs); i++ { |
| 185 | if chDesc.ID == sw.chDescs[i].ID { |
| 186 | sw.chDescs = append(sw.chDescs[:i], sw.chDescs[i+1:]...) |
| 187 | break |
| 188 | } |
| 189 | } |
| 190 | delete(sw.reactorsByCh, chDesc.ID) |
| 191 | delete(sw.msgTypeByChID, chDesc.ID) |
| 192 | } |
| 193 | delete(sw.reactors, name) |
| 194 | reactor.SetSwitch(nil) |
| 195 | } |
| 196 | |
| 197 | // Reactors returns a map of reactors registered on the switch. |
| 198 | // NOTE: Not goroutine safe. |
no test coverage detected