small fixes

This commit is contained in:
Radu Ioan Fericean
2013-12-17 18:02:54 +02:00
parent d69378a626
commit c0d7cf0001
2 changed files with 4 additions and 2 deletions

View File

@@ -50,9 +50,9 @@ func (d *Destination) containsPrefix(prefix string) int {
}
}
if d.longPrefixesMap != nil {
for i, p := range utils.SplitPrefix(prefix) {
for _, p := range utils.SplitPrefix(prefix) {
if _, found := d.longPrefixesMap[p]; found {
return len(prefix) - i
return len(p)
}
}
}

View File

@@ -253,6 +253,8 @@ func (rs *RedisStorage) GetDestination(key string, checkDb bool) (dest *Destinat
}
dest.OptimizePrefixes()
cache2go.Cache(key, dest)
} else {
return nil, errors.New("not found")
}
return
}