-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ONT-927 optimize sync block msg send #404
Conversation
consensus/vbft/node_sync.go
Outdated
@@ -400,7 +401,7 @@ func (self *PeerSyncer) requestBlock(blkNum uint32) (*Block, error) { | |||
return nil, err | |||
} | |||
self.server.msgSendC <- &SendMsgEvent{ | |||
ToPeer: self.peerIdx, | |||
ToPeer: math.MaxUint32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only broadcasting support, consider fix this in self.server.msgSendC handling??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I will delete some unused code,like send to peer function.
c98f48b
to
3b126ea
Compare
consensus/vbft/peer_pool.go
Outdated
@@ -266,3 +268,17 @@ func (pool *PeerPool) getPeer(idx uint32) *Peer { | |||
|
|||
return nil | |||
} | |||
|
|||
func (pool *PeerPool) addP2pId(peerIdx uint32, p2pId uint64) { | |||
pool.lock.RLock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need Lock
consensus/vbft/service.go
Outdated
if !present { | ||
self.peerPool.addP2pId(peerIdx, payload.PeerId) | ||
} else { | ||
if p2pid != payload.PeerId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use if !present || p2pid != payload.PeerId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
consensus/vbft/service.go
Outdated
self.peerPool.addP2pId(peerIdx, payload.PeerId) | ||
} | ||
} | ||
self.peerPool.addP2pId(peerIdx, payload.PeerId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant ?
No description provided.