Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 96c5af3

Browse files
committedMay 18, 2015
use direct fronting to fetch config in lantern-android
1 parent a61832a commit 96c5af3

File tree

1 file changed

+9
-14
lines changed
  • src/github.com/getlantern/lantern-android/client

1 file changed

+9
-14
lines changed
 

‎src/github.com/getlantern/lantern-android/client/client.go

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/getlantern/analytics"
1111
"github.com/getlantern/flashlight/client"
1212
"github.com/getlantern/flashlight/globals"
13-
"github.com/getlantern/flashlight/util"
1413
)
1514

1615
const (
@@ -28,7 +27,8 @@ var (
2827
// MobileClient is an extension of flashlight client with a few custom declarations for mobile
2928
type MobileClient struct {
3029
client.Client
31-
closed chan bool
30+
closed chan bool
31+
fronter *http.Client
3232
}
3333

3434
// init attempts to setup client configuration.
@@ -75,8 +75,9 @@ func NewClient(addr, appName string) *MobileClient {
7575
analytics.SessionEvent(hqfdc, sessionPayload)
7676

7777
return &MobileClient{
78-
Client: client,
79-
closed: make(chan bool),
78+
Client: client,
79+
closed: make(chan bool),
80+
fronter: hqfdc,
8081
}
8182
}
8283

@@ -103,18 +104,11 @@ func (client *MobileClient) ServeHTTP() {
103104
// updateConfig attempts to pull a configuration file from the network using
104105
// the client proxy itself.
105106
func (client *MobileClient) updateConfig() error {
106-
var err error
107107
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 {
115110
return err
116111
}
117-
118112
return clientConfig.updateFrom(buf)
119113
}
120114

@@ -133,7 +127,8 @@ func (client *MobileClient) pollConfiguration() {
133127
var err error
134128
if err = client.updateConfig(); err == nil {
135129
// Configuration changed, lets reload.
136-
client.Configure(clientConfig.Client)
130+
hqfc := client.Configure(clientConfig.Client)
131+
client.fronter = hqfc.NewDirectDomainFronter()
137132
}
138133
// Sleeping 'till next pull.
139134
pollTimer.Reset(cloudConfigPollInterval)

0 commit comments

Comments
 (0)
Please sign in to comment.