From 55ab799febcf1ced63c067c331f77f98d2260c13 Mon Sep 17 00:00:00 2001 From: Myles Horton Date: Tue, 18 Aug 2015 14:02:03 -0700 Subject: [PATCH] Use separate copies of http.Client closes #2976 --- src/github.com/getlantern/flashlight/flashlight.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/github.com/getlantern/flashlight/flashlight.go b/src/github.com/getlantern/flashlight/flashlight.go index 40ca52e8f5..cb79de52d7 100644 --- a/src/github.com/getlantern/flashlight/flashlight.go +++ b/src/github.com/getlantern/flashlight/flashlight.go @@ -356,11 +356,11 @@ func applyClientConfig(client *client.Client, cfg *config.Config) { if hqfd == nil { log.Errorf("No fronted dialer available, not enabling geolocation, config lookup, or stats") } else { - // An *http.Client that uses the highest QOS dialer. - hqfdClient := hqfd.NewDirectDomainFronter() - config.Configure(hqfdClient) - geolookup.Configure(hqfdClient) - statserver.Configure(hqfdClient) + // Give everyone their own *http.Client that uses the highest QOS dialer. Separate + // clients for everyone avoids data races configuring those clients. + config.Configure(hqfd.NewDirectDomainFronter()) + geolookup.Configure(hqfd.NewDirectDomainFronter()) + statserver.Configure(hqfd.NewDirectDomainFronter()) // Note we don't call Configure on analytics here, as that would // result in an extra analytics call and double counting. }