mirror of
https://gitee.com/IrisVega/frp.git
synced 2024-11-01 22:31:29 +08: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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
kcpDoneCh := make(chan struct{})
|
closedDoneCh := make(chan struct{})
|
||||||
// Capture the exit signal if we use kcp.
|
shouldGracefulClose := cfg.Protocol == "kcp" || cfg.Protocol == "quic"
|
||||||
if cfg.Protocol == "kcp" {
|
// Capture the exit signal if we use kcp or quic.
|
||||||
go handleSignal(svr, kcpDoneCh)
|
if shouldGracefulClose {
|
||||||
|
go handleSignal(svr, closedDoneCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = svr.Run()
|
err = svr.Run()
|
||||||
if err == nil && cfg.Protocol == "kcp" {
|
if err == nil && shouldGracefulClose {
|
||||||
<-kcpDoneCh
|
<-closedDoneCh
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user