mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-01-07 13:58:50 +01:00
main
- Bugfix, fix consistent hash problem where if failure happens then causes panic
This commit is contained in:
parent
77aac5534b
commit
bf53108384
@ -54,9 +54,6 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
|||||||
s.manager.GetRouteManager().UpdateRoutes()
|
s.manager.GetRouteManager().UpdateRoutes()
|
||||||
|
|
||||||
publicKey := s.manager.GetPublicKey()
|
publicKey := s.manager.GetPublicKey()
|
||||||
|
|
||||||
logging.Log.WriteInfof(publicKey.String())
|
|
||||||
|
|
||||||
nodeNames := correspondingMesh.GetPeers()
|
nodeNames := correspondingMesh.GetPeers()
|
||||||
|
|
||||||
if self != nil {
|
if self != nil {
|
||||||
@ -68,7 +65,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
|||||||
var gossipNodes []string
|
var gossipNodes []string
|
||||||
|
|
||||||
// Clients always pings its peer for configuration
|
// Clients always pings its peer for configuration
|
||||||
if self != nil && self.GetType() == conf.CLIENT_ROLE {
|
if self != nil && self.GetType() == conf.CLIENT_ROLE && len(nodeNames) > 1 {
|
||||||
keyFunc := lib.HashString
|
keyFunc := lib.HashString
|
||||||
bucketFunc := lib.HashString
|
bucketFunc := lib.HashString
|
||||||
|
|
||||||
@ -92,6 +89,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
|||||||
|
|
||||||
if correspondingPeer == nil {
|
if correspondingPeer == nil {
|
||||||
logging.Log.WriteErrorf("node %s does not exist", node)
|
logging.Log.WriteErrorf("node %s does not exist", node)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
err := s.requester.SyncMesh(meshId, correspondingPeer)
|
err := s.requester.SyncMesh(meshId, correspondingPeer)
|
||||||
@ -104,6 +102,10 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
|||||||
// itself
|
// itself
|
||||||
s.manager.GetMesh(meshId).Mark(node)
|
s.manager.GetMesh(meshId).Mark(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logging.Log.WriteInfof(err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.syncCount++
|
s.syncCount++
|
||||||
|
Loading…
Reference in New Issue
Block a user