mirror of https://github.com/poanetwork/gecko.git
Fixed deadlock issue
This commit is contained in:
parent
6318186848
commit
312e17bfb3
|
@ -51,7 +51,7 @@ func (h *Handler) Dispatch() {
|
|||
log.Debug("dropping message due to closing:\n%s", msg)
|
||||
continue
|
||||
}
|
||||
if !h.dispatchMsg(msg) {
|
||||
if h.dispatchMsg(msg) {
|
||||
closing = true
|
||||
}
|
||||
case msg := <-h.msgChan:
|
||||
|
@ -59,7 +59,7 @@ func (h *Handler) Dispatch() {
|
|||
log.Debug("dropping internal message due to closing:\n%s", msg)
|
||||
continue
|
||||
}
|
||||
if !h.dispatchMsg(message{messageType: notifyMsg, notification: msg}) {
|
||||
if h.dispatchMsg(message{messageType: notifyMsg, notification: msg}) {
|
||||
closing = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,11 +263,12 @@ func (sr *ChainRouter) Shutdown() {
|
|||
chain.Shutdown()
|
||||
close(chain.msgs)
|
||||
}
|
||||
for _, chain := range sr.chains {
|
||||
sr.chains = map[[32]byte]*Handler{}
|
||||
prevChains := sr.chains
|
||||
sr.lock.Unlock()
|
||||
for _, chain := range prevChains {
|
||||
chain.wg.Wait()
|
||||
}
|
||||
sr.chains = map[[32]byte]*Handler{}
|
||||
sr.lock.Unlock()
|
||||
sr.gossiper.Stop()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue