diff options
-rw-r--r-- | gobgpd/main.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 05c20555..15ad1a56 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -30,13 +30,14 @@ import ( "os" "os/signal" "runtime" + "runtime/debug" "strings" "syscall" ) func main() { sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGTERM) + signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGUSR1) var opts struct { ConfigFile string `short:"f" long:"config-file" description:"specifying a config file"` @@ -260,6 +261,9 @@ func main() { reloadCh <- true case syscall.SIGKILL, syscall.SIGTERM: bgpServer.Shutdown() + case syscall.SIGUSR1: + runtime.GC() + debug.FreeOSMemory() } } } |