Skip to content
Snippets Groups Projects
Commit ccf0bfa4 authored by jkito's avatar jkito :skull:
Browse files

obfs4: stop obfs4 client and proxy in a go routine

the Stop is blocking and cannot be called concurrently
with Start, when for some reason obfs4 client fails to
connect and has not yet returned from Start, a call to
Stop will block until Start has returned, which  makes
UI unresponsive for some time

calling it in a separate Go routine works around  this
issue as we can proceed to stop the openvpn process
parent 3c9a86e1
Branches
Tags
1 merge request!239obfs4: stop obfs4 client and proxy in a go routine
......@@ -376,11 +376,18 @@ func (b *Bitmask) StopVPN() error {
if err != nil {
return err
}
// try to stop obfsvpn client in a go routine
// as the stop operation takes time and might
// block if start didn't return yet
if b.obfsvpnProxy != nil {
if _, err := b.obfsvpnProxy.Stop(); err != nil {
log.Debug().Err(err).Msg("Error while stop obfsvpn proxy")
}
b.obfsvpnProxy = nil
go func() {
if _, err := b.obfsvpnProxy.Stop(); err != nil {
log.Debug().
Err(err).
Msg("Error while stop obfsvpn proxy")
}
b.obfsvpnProxy = nil
}()
}
b.tryStopFromManagement()
if err := b.launch.OpenvpnStop(); err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment