@@ -10,7 +10,6 @@ import (
10
10
"github.com/getlantern/analytics"
11
11
"github.com/getlantern/flashlight/client"
12
12
"github.com/getlantern/flashlight/globals"
13
- "github.com/getlantern/flashlight/util"
14
13
)
15
14
16
15
const (
28
27
// MobileClient is an extension of flashlight client with a few custom declarations for mobile
29
28
type MobileClient struct {
30
29
client.Client
31
- closed chan bool
30
+ closed chan bool
31
+ fronter * http.Client
32
32
}
33
33
34
34
// init attempts to setup client configuration.
@@ -75,8 +75,9 @@ func NewClient(addr, appName string) *MobileClient {
75
75
analytics .SessionEvent (hqfdc , sessionPayload )
76
76
77
77
return & MobileClient {
78
- Client : client ,
79
- closed : make (chan bool ),
78
+ Client : client ,
79
+ closed : make (chan bool ),
80
+ fronter : hqfdc ,
80
81
}
81
82
}
82
83
@@ -103,18 +104,11 @@ func (client *MobileClient) ServeHTTP() {
103
104
// updateConfig attempts to pull a configuration file from the network using
104
105
// the client proxy itself.
105
106
func (client * MobileClient ) updateConfig () error {
106
- var err error
107
107
var buf []byte
108
- var cli * http.Client
109
-
110
- if cli , err = util .HTTPClient (cloudConfigCA , client .Addr ); err != nil {
111
- return err
112
- }
113
-
114
- if buf , err = pullConfigFile (cli ); err != nil {
108
+ var err error
109
+ if buf , err = pullConfigFile (client .fronter ); err != nil {
115
110
return err
116
111
}
117
-
118
112
return clientConfig .updateFrom (buf )
119
113
}
120
114
@@ -133,7 +127,8 @@ func (client *MobileClient) pollConfiguration() {
133
127
var err error
134
128
if err = client .updateConfig (); err == nil {
135
129
// Configuration changed, lets reload.
136
- client .Configure (clientConfig .Client )
130
+ hqfc := client .Configure (clientConfig .Client )
131
+ client .fronter = hqfc .NewDirectDomainFronter ()
137
132
}
138
133
// Sleeping 'till next pull.
139
134
pollTimer .Reset (cloudConfigPollInterval )
0 commit comments