Avoid deadlock on double close
This commit is contained in:
parent
35247bd044
commit
023d1a6e5d
|
@ -297,13 +297,15 @@ func (tp *torProvider) Close() {
|
||||||
delete(tp.childListeners, addr)
|
delete(tp.childListeners, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Break out of any background checks and close
|
if !tp.isClosed {
|
||||||
// the underlying tor connection
|
// Break out of any background checks and close
|
||||||
tp.isClosed = true
|
// the underlying tor connection
|
||||||
tp.breakChan <- true
|
tp.isClosed = true
|
||||||
if tp.t != nil {
|
tp.breakChan <- true
|
||||||
tp.t.Close()
|
if tp.t != nil {
|
||||||
tp.t = nil
|
tp.t.Close()
|
||||||
|
tp.t = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue