mirror of
https://github.com/sigcn/pg.git
synced 2025-10-28 11:51:26 +08:00
vpn: graceful shutdown
This commit is contained in:
@@ -55,10 +55,10 @@ func (vpn *VPN) Run(ctx context.Context, iface iface.Interface, packetConn net.P
|
||||
go vpn.runPacketConnWriteEventLoop(&wg, packetConn)
|
||||
|
||||
<-ctx.Done()
|
||||
packetConn.Close()
|
||||
iface.Close()
|
||||
close(vpn.inbound)
|
||||
close(vpn.outbound)
|
||||
iface.Close()
|
||||
packetConn.Close()
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user