Skip to content

Commit d105263

Browse files
committed
stack: Fix close before start
1 parent 355e4e8 commit d105263

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stack_gvisor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ func (t *GVisor) Start() error {
9797
}
9898

9999
func (t *GVisor) Close() error {
100+
if t.stack == nil {
101+
return nil
102+
}
100103
t.endpoint.Attach(nil)
101104
t.stack.Close()
102105
for _, endpoint := range t.stack.CleanupEndpoints() {

stack_mixed.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ func (m *Mixed) packetLoop() {
224224
}
225225

226226
func (m *Mixed) Close() error {
227+
if m.stack == nil {
228+
return nil
229+
}
227230
m.endpoint.Attach(nil)
228231
m.stack.Close()
229232
for _, endpoint := range m.stack.CleanupEndpoints() {

0 commit comments

Comments
 (0)