Skip to content

Commit

Permalink
fix working with public config
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron authored and aleksej-paschenko committed Dec 21, 2023
1 parent b13bcce commit 0a2ad0f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion liteapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/base64"
"errors"
"fmt"
"math/rand"
"net/http"
"os"
"sync"
Expand Down Expand Up @@ -253,7 +254,12 @@ func NewClient(opts ...Option) (*Client, error) {
if err != nil {
continue
}
liteclients = append(liteclients, liteclient.NewClient(c, liteclient.OptionTimeout(options.Timeout)))
lc := liteclient.NewClient(c, liteclient.OptionTimeout(options.Timeout))
_, err = lc.LiteServerGetMasterchainInfo(options.InitCtx)
if err != nil {
continue
}
liteclients = append(liteclients, lc)
if len(liteclients) >= options.MaxConnections {
break
}
Expand Down Expand Up @@ -990,5 +996,8 @@ func downloadConfig(path string) (*config.GlobalConfigurationFile, error) {
configCache[path] = o
configCacheMutex.Unlock()
}
rand.Shuffle(len(o.LiteServers), func(i, j int) {
o.LiteServers[i], o.LiteServers[j] = o.LiteServers[j], o.LiteServers[i]
})
return o, err
}

0 comments on commit 0a2ad0f

Please sign in to comment.