From 3489e7ec917cd00d1995cd7a0f669bfc8aff0a8e Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Fri, 29 Mar 2019 13:00:55 +0800 Subject: dex: fix initial build connection bug (#311) --- dex/handler.go | 9 +++++---- dex/peer.go | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dex/handler.go b/dex/handler.go index 6d0746d2f..161f4a4d8 100644 --- a/dex/handler.go +++ b/dex/handler.go @@ -1302,10 +1302,11 @@ func (pm *ProtocolManager) SetReceiveCoreMessage(enabled bool) { // a loop keep building and maintaining peers in notary set. // TODO: finish this func (pm *ProtocolManager) peerSetLoop() { - log.Debug("ProtocolManager: started peer set loop") - round := pm.gov.Round() - log.Trace("ProtocolManager: startup round", "round", round) + resetCount := pm.gov.DKGResetCount(round) + log.Debug("ProtocolManager: startup round", + "round", round, + "reset", resetCount) if round < dexCore.DKGDelayRound { for i := round; i <= dexCore.DKGDelayRound; i++ { @@ -1319,8 +1320,8 @@ func (pm *ProtocolManager) peerSetLoop() { if CRSRound > round { pm.peers.BuildConnection(CRSRound) round = CRSRound + resetCount = pm.gov.DKGResetCount(round) } - resetCount := uint64(0) for { select { diff --git a/dex/peer.go b/dex/peer.go index 0d23e630f..d3650d00d 100644 --- a/dex/peer.go +++ b/dex/peer.go @@ -929,6 +929,8 @@ func (ps *peerSet) ForgetConnection(round uint64) { ps.lock.Lock() defer ps.lock.Unlock() + log.Debug("Forget connection", "round", round) + for label := range ps.directConn { if label.round <= round { ps.forgetDirectConn(label) -- cgit v1.2.3