mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-01-05 21:09:07 +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()
|
||||
|
||||
publicKey := s.manager.GetPublicKey()
|
||||
|
||||
logging.Log.WriteInfof(publicKey.String())
|
||||
|
||||
nodeNames := correspondingMesh.GetPeers()
|
||||
|
||||
if self != nil {
|
||||
@ -68,7 +65,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
var gossipNodes []string
|
||||
|
||||
// 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
|
||||
bucketFunc := lib.HashString
|
||||
|
||||
@ -92,6 +89,7 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
|
||||
if correspondingPeer == nil {
|
||||
logging.Log.WriteErrorf("node %s does not exist", node)
|
||||
continue
|
||||
}
|
||||
|
||||
err := s.requester.SyncMesh(meshId, correspondingPeer)
|
||||
@ -104,6 +102,10 @@ func (s *SyncerImpl) Sync(meshId string) error {
|
||||
// itself
|
||||
s.manager.GetMesh(meshId).Mark(node)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logging.Log.WriteInfof(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
s.syncCount++
|
||||
|
Loading…
Reference in New Issue
Block a user