Skip to content

Commit

Permalink
Separate url client from log client (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
taknira authored and pphaneuf committed Apr 12, 2016
1 parent 3e1f535 commit 21f6fe3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fixchain/fix_and_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ func (fl *FixAndLog) Wait() {
// are added to its queue, and then log them to the Certificate Transparency log
// found at the given url. Any errors encountered along the way are pushed to
// the given errors channel.
func NewFixAndLog(fixerWorkerCount int, loggerWorkerCount int, errors chan<- *FixError, client *http.Client, logURL string, limiter Limiter, logStats bool) *FixAndLog {
func NewFixAndLog(fixerWorkerCount int, loggerWorkerCount int, errors chan<- *FixError, client *http.Client, logClient *http.Client, logURL string, limiter Limiter, logStats bool) *FixAndLog {
chains := make(chan []*x509.Certificate)
fl := &FixAndLog{
fixer: NewFixer(fixerWorkerCount, chains, errors, client, logStats),
chains: chains,
logger: NewLogger(loggerWorkerCount, logURL, errors, client, limiter, logStats),
logger: NewLogger(loggerWorkerCount, logURL, errors, logClient, limiter, logStats),
done: newLockedMap(),
}

Expand Down
3 changes: 2 additions & 1 deletion fixchain/fix_and_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ func TestNewFixAndLog(t *testing.T) {
for i, test := range newFixAndLogTests {
seen := make([]bool, len(test.expLoggedChains))
errors := make(chan *FixError)
fl := NewFixAndLog(1, 1, errors, &http.Client{Transport: &testRoundTripper{t: t, test: &test, testIndex: i, seen: seen}}, test.url, newNilLimiter(), false)
client := &http.Client{Transport: &testRoundTripper{t: t, test: &test, testIndex: i, seen: seen}}
fl := NewFixAndLog(1, 1, errors, client, client, test.url, newNilLimiter(), false)

var wg sync.WaitGroup
wg.Add(1)
Expand Down
3 changes: 2 additions & 1 deletion fixchain/main/fixchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func main() {
go logStringErrors(&wg, errors, errDir)

limiter := ratelimiter.NewLimiter(1000)
fl := fixchain.NewFixAndLog(100, 100, errors, &http.Client{}, logURL, limiter, true)
client := &http.Client{}
fl := fixchain.NewFixAndLog(100, 100, errors, client, client, logURL, limiter, true)

processChains(chainsFile, fl)

Expand Down

0 comments on commit 21f6fe3

Please sign in to comment.