mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 07:26:24 -05:00
defer server close
This commit is contained in:
parent
c49b93b39e
commit
0bc22154e5
11
main/main.go
11
main/main.go
@ -109,6 +109,7 @@ func main() {
|
|||||||
// Configuration error. Exit with a special value to prevent systemd from restarting.
|
// Configuration error. Exit with a special value to prevent systemd from restarting.
|
||||||
os.Exit(23)
|
os.Exit(23)
|
||||||
}
|
}
|
||||||
|
defer server.Close()
|
||||||
|
|
||||||
if *test {
|
if *test {
|
||||||
fmt.Println("Configuration OK.")
|
fmt.Println("Configuration OK.")
|
||||||
@ -123,9 +124,9 @@ func main() {
|
|||||||
// Explicitly triggering GC to remove garbage from config loading.
|
// Explicitly triggering GC to remove garbage from config loading.
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
|
|
||||||
osSignals := make(chan os.Signal, 1)
|
{
|
||||||
signal.Notify(osSignals, os.Interrupt, os.Kill, syscall.SIGTERM)
|
osSignals := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(osSignals, os.Interrupt, os.Kill, syscall.SIGTERM)
|
||||||
<-osSignals
|
<-osSignals
|
||||||
server.Close()
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user