1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-26 09:25:23 +00:00

defer server close

This commit is contained in:
Darien Raymond 2018-12-04 14:15:35 +01:00
parent c49b93b39e
commit 0bc22154e5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -109,6 +109,7 @@ func main() {
// Configuration error. Exit with a special value to prevent systemd from restarting.
os.Exit(23)
}
defer server.Close()
if *test {
fmt.Println("Configuration OK.")
@ -123,9 +124,9 @@ func main() {
// Explicitly triggering GC to remove garbage from config loading.
runtime.GC()
osSignals := make(chan os.Signal, 1)
signal.Notify(osSignals, os.Interrupt, os.Kill, syscall.SIGTERM)
<-osSignals
server.Close()
{
osSignals := make(chan os.Signal, 1)
signal.Notify(osSignals, os.Interrupt, os.Kill, syscall.SIGTERM)
<-osSignals
}
}