mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-02 11:27:39 +03:00
stack: Fix close before start
This commit is contained in:
parent
355e4e81cc
commit
d105263fed
2 changed files with 6 additions and 0 deletions
|
@ -97,6 +97,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() {
|
||||
|
|
|
@ -224,6 +224,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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue