add judgement about truncate for 'NameBelongsToCluster'

This commit is contained in:
chentao1596 2017-03-30 15:44:11 +08:00
parent 0d80f0db33
commit 50e7c19b5f

View file

@ -206,8 +206,14 @@ func (n *Namer) NameBelongsToCluster(name string) bool {
glog.Warningf("Too many parts to name %v, ignoring", name) glog.Warningf("Too many parts to name %v, ignoring", name)
return false return false
} }
if len(name) > nameLenLimit {
glog.V(4).Infof("%s has been truncated", name)
return strings.HasPrefix(clusterName, strings.TrimSuffix(parts[1], alphaNumericChar))
}else{
return parts[1] == clusterName return parts[1] == clusterName
} }
}
// BeName constructs the name for a backend. // BeName constructs the name for a backend.
func (n *Namer) BeName(port int64) string { func (n *Namer) BeName(port int64) string {