MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / RemoveReactor

Method RemoveReactor

p2p/switch.go:181–195  ·  view source on GitHub ↗

RemoveReactor removes the given Reactor from the Switch. NOTE: Not goroutine safe.

(name string, reactor Reactor)

Source from the content-addressed store, hash-verified

179// RemoveReactor removes the given Reactor from the Switch.
180// NOTE: Not goroutine safe.
181func (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.

Callers 3

CustomReactorsFunction · 0.80
CustomReactorsFunction · 0.80

Calls 2

GetChannelsMethod · 0.65
SetSwitchMethod · 0.65

Tested by

no test coverage detected