Close stack faster

This commit is contained in:
世界 2022-07-31 19:55:51 +08:00
parent d5dd3b3bb1
commit 4a805410a2
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 3 additions and 3 deletions

View file

@ -30,6 +30,7 @@ type GVisorTun struct {
endpointIndependentNatTimeout int64
handler Handler
stack *stack.Stack
endpoint stack.LinkEndpoint
}
func NewGVisor(
@ -158,10 +159,12 @@ func (t *GVisorTun) Start() error {
}
t.stack = ipStack
t.endpoint = linkEndpoint
return nil
}
func (t *GVisorTun) Close() error {
t.endpoint.Attach(nil)
t.stack.Close()
for _, endpoint := range t.stack.CleanupEndpoints() {
endpoint.Abort()