mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 01:07:03 +08:00
Fix(engine): mutex never unlocked on error (#456)
* fix error when mutex never unlock --------- Co-authored-by: devil666face <artem1999k@gmail.com> Co-authored-by: Jason Lyu <xjasonlyu@gmail.com>
This commit is contained in:
@@ -62,6 +62,8 @@ func Insert(k *Key) {
|
|||||||
|
|
||||||
func start() error {
|
func start() error {
|
||||||
_engineMu.Lock()
|
_engineMu.Lock()
|
||||||
|
defer _engineMu.Unlock()
|
||||||
|
|
||||||
if _defaultKey == nil {
|
if _defaultKey == nil {
|
||||||
return errors.New("empty key")
|
return errors.New("empty key")
|
||||||
}
|
}
|
||||||
@@ -75,7 +77,6 @@ func start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_engineMu.Unlock()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user