osrg / gobgp

BGP implemented in the Go Programming Language
https://osrg.github.io/gobgp/
Apache License 2.0
3.66k stars 699 forks source link

Ability to kill the Serve method #2760

Open OCharless opened 10 months ago

OCharless commented 10 months ago

Currently, the bgp server is running endlessly. It's goten shut down when the main program stops. This PR have as a purpose to supply an optional channel in order to stop gracefully the Serve method whenever it's needed.

fujita commented 9 months ago

Already supported: https://github.com/osrg/gobgp/blob/815683fa5e0d1e210e436bfa589588d9d2c19015/api/gobgp.proto#L36

saser commented 9 months ago

Also note that the BgpServer type has a Stop method that will call the StopBgp API method for you: https://github.com/osrg/gobgp/blob/815683fa5e0d1e210e436bfa589588d9d2c19015/pkg/server/server.go#L219-L225. Just calling Stop() has been sufficient when I've used it.