[NOD-1206] Call peer.StartIBD in new goroutine (#833)

This commit is contained in:
Ori Newman 2020-07-29 12:03:59 +03:00 committed by GitHub
parent 211c4d05e8
commit 94f617b06a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -41,6 +41,7 @@ func (c *gRPCConnection) sendLoop() error {
return err
}
log.Debugf("outgoing '%s' message to %s", message.Command(), c)
log.Tracef("outgoing '%s' message to %s: %s", message.Command(), c, logger.NewLogClosure(func() string {
return spew.Sdump(message)
}))
@ -74,6 +75,7 @@ func (c *gRPCConnection) receiveLoop() error {
return err
}
log.Debugf("incoming '%s' message from %s", message.Command(), c)
log.Tracef("incoming '%s' message from %s: %s", message.Command(), c, logger.NewLogClosure(func() string {
return spew.Sdump(message)
}))

View File

@ -25,7 +25,7 @@ func (f *FlowContext) StartIBDIfRequired() {
atomic.StoreUint32(&f.isInIBD, 1)
f.ibdPeer = peer
peer.StartIBD()
spawn("StartIBDIfRequired-peer.StartIBD", peer.StartIBD)
}
// IsInIBD is true if IBD is currently running

View File

@ -2,6 +2,8 @@ package flowcontext
import (
"github.com/kaspanet/kaspad/logger"
"github.com/kaspanet/kaspad/util/panics"
)
var log, _ = logger.Get(logger.SubsystemTags.PROT)
var spawn = panics.GoroutineWrapperFunc(log)