mirror of
https://github.com/sigcn/pg.git
synced 2025-10-28 21:11:48 +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)
|
go vpn.runPacketConnWriteEventLoop(&wg, packetConn)
|
||||||
|
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
|
packetConn.Close()
|
||||||
|
iface.Close()
|
||||||
close(vpn.inbound)
|
close(vpn.inbound)
|
||||||
close(vpn.outbound)
|
close(vpn.outbound)
|
||||||
iface.Close()
|
|
||||||
packetConn.Close()
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user