aboutsummaryrefslogtreecommitdiffstats
path: root/core/configuration-chain.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-29 14:23:39 +0800
committerGitHub <noreply@github.com>2018-10-29 14:23:39 +0800
commitdcc2319797d3ab78ff0611b82c56d43803675e3c (patch)
tree625e87343ff1f57e5ed54ee6cb2b3cf0a323edc7 /core/configuration-chain.go
parent843f43bf245f0398fc581e885943661967ca1bc0 (diff)
downloaddexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar.gz
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar.bz2
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar.lz
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar.xz
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.tar.zst
dexon-consensus-dcc2319797d3ab78ff0611b82c56d43803675e3c.zip
core: Fix goroutine leaks (#270)
Diffstat (limited to 'core/configuration-chain.go')
-rw-r--r--core/configuration-chain.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/configuration-chain.go b/core/configuration-chain.go
index 559eac0..bf24c31 100644
--- a/core/configuration-chain.go
+++ b/core/configuration-chain.go
@@ -205,6 +205,12 @@ func (cc *configurationChain) touchTSigHash(hash common.Hash) (first bool) {
return !exist
}
+func (cc *configurationChain) untouchTSigHash(hash common.Hash) {
+ cc.tsigReady.L.Lock()
+ defer cc.tsigReady.L.Unlock()
+ delete(cc.tsigTouched, hash)
+}
+
func (cc *configurationChain) runTSig(
round uint64, hash common.Hash) (
crypto.Signature, error) {
@@ -240,10 +246,10 @@ func (cc *configurationChain) runTSig(
signature, err = cc.tsig[hash].signature()
return err == ErrNotEnoughtPartialSignatures
}() {
+ // TODO(jimmy-dexon): add a timeout here.
cc.tsigReady.Wait()
}
delete(cc.tsig, hash)
- delete(cc.tsigTouched, hash)
if err != nil {
return crypto.Signature{}, err
}