check number of shadowsocks servers

pull/432/head
Darien Raymond 2017-04-11 13:42:10 +02:00
parent ac8d882a55
commit 8bb2d02f78
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,9 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
for _, rec := range config.Server {
serverList.AddServer(protocol.NewServerSpecFromPB(*rec))
}
if serverList.Size() == 0 {
return nil, newError("0 server")
}
client := &Client{
serverPicker: protocol.NewRoundRobinServerPicker(serverList),
}