Skip to content

Commit

Permalink
stack: Fix close before start
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 18, 2024
1 parent f9755b8 commit c09544f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stack_gvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (t *GVisor) Start() error {
}

func (t *GVisor) Close() error {
if t.stack == nil {
return nil
}
t.endpoint.Attach(nil)
t.stack.Close()
for _, endpoint := range t.stack.CleanupEndpoints() {
Expand Down
3 changes: 3 additions & 0 deletions stack_mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ func (m *Mixed) packetLoop() {
}

func (m *Mixed) Close() error {
if m.stack == nil {
return nil
}
m.endpoint.Attach(nil)
m.stack.Close()
for _, endpoint := range m.stack.CleanupEndpoints() {
Expand Down

0 comments on commit c09544f

Please sign in to comment.