OnStop implements BaseService. It stops all peers and reactors.
()
| 245 | |
| 246 | // OnStop implements BaseService. It stops all peers and reactors. |
| 247 | func (sw *Switch) OnStop() { |
| 248 | // Stop peers |
| 249 | for _, p := range sw.peers.List() { |
| 250 | sw.stopAndRemovePeer(p, nil) |
| 251 | } |
| 252 | |
| 253 | // Stop reactors |
| 254 | sw.Logger.Debug("Switch: Stopping reactors") |
| 255 | for _, reactor := range sw.reactors { |
| 256 | if err := reactor.Stop(); err != nil { |
| 257 | sw.Logger.Error("error while stopped reactor", "reactor", reactor, "error", err) |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | //--------------------------------------------------------------------- |
| 263 | // Peers |
nothing calls this directly
no test coverage detected