cmd/strelaysrv: Fix JSON unmarshalling when joining a relay pool (fixes #6733) (#6729)

This commit is contained in:
Gleb Sinyavskiy 2020-06-10 11:26:09 +02:00 committed by GitHub
parent b6b6caeab5
commit 091cb5e611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,7 @@ func poolHandler(pool string, uri *url.URL, mapping mapping) {
var x struct {
EvictionIn time.Duration `json:"evictionIn"`
}
if err := json.NewDecoder(resp.Body).Decode(&x); err == nil {
if err := json.Unmarshal(bs, &x); err == nil {
rejoin := x.EvictionIn - (x.EvictionIn / 5)
log.Printf("Joined pool %s, rejoining in %v", pool, rejoin)
time.Sleep(rejoin)