500 error if there are no su3s

This commit is contained in:
Matt Drollette
2015-03-16 22:35:34 -05:00
parent 36c2a980d3
commit 8d31f97123
2 changed files with 6 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package reseed
import (
"crypto/rsa"
"crypto/sha256"
"errors"
"fmt"
"hash/crc32"
"io/ioutil"
@@ -199,6 +200,10 @@ func (rs *ReseederImpl) PeerSu3Bytes(peer Peer) ([]byte, error) {
m := <-rs.su3s
defer func() { rs.su3s <- m }()
if 0 == len(m) {
return nil, errors.New("404")
}
return m[peer.Hash()%len(m)], nil
}