mirror of
https://github.com/fatedier/frp.git
synced 2024-12-22 22:45:06 +07:00
frpc: do a graceful close for quic protocol at exit (#3282)
This commit is contained in:
parent
24c7d1d9e2
commit
b1b8d9a82b
@ -216,15 +216,16 @@ func startService(
|
||||
return
|
||||
}
|
||||
|
||||
kcpDoneCh := make(chan struct{})
|
||||
// Capture the exit signal if we use kcp.
|
||||
if cfg.Protocol == "kcp" {
|
||||
go handleSignal(svr, kcpDoneCh)
|
||||
closedDoneCh := make(chan struct{})
|
||||
shouldGracefulClose := cfg.Protocol == "kcp" || cfg.Protocol == "quic"
|
||||
// Capture the exit signal if we use kcp or quic.
|
||||
if shouldGracefulClose {
|
||||
go handleSignal(svr, closedDoneCh)
|
||||
}
|
||||
|
||||
err = svr.Run()
|
||||
if err == nil && cfg.Protocol == "kcp" {
|
||||
<-kcpDoneCh
|
||||
if err == nil && shouldGracefulClose {
|
||||
<-closedDoneCh
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user