Fix bug with empty subsets

This commit is contained in:
Daniel Smith
2015-09-24 10:48:19 -07:00
parent 0662141f67
commit 50a98d8fc0
2 changed files with 19 additions and 0 deletions

View File

@@ -295,6 +295,9 @@ func (rs *REST) ResourceLocation(ctx api.Context, id string) (*url.URL, http.Rou
// Find a Subset that has the port.
for ssi := 0; ssi < len(eps.Subsets); ssi++ {
ss := &eps.Subsets[(ssSeed+ssi)%len(eps.Subsets)]
if len(ss.Addresses) == 0 {
continue
}
for i := range ss.Ports {
if ss.Ports[i].Name == portStr {
// Pick a random address.