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