submitct: include cert index in log entries

This commit is contained in:
Andrew Ayer 2017-02-04 16:09:56 -08:00
parent e7a9ba6e7d
commit 779230cbc8
1 changed files with 5 additions and 5 deletions

View File

@ -164,7 +164,7 @@ func main() {
} }
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for _, cert := range certs { for index, cert := range certs {
chain := buildChain(cert, certs) chain := buildChain(cert, certs)
if len(chain) == 0 { if len(chain) == 0 {
continue continue
@ -172,17 +172,17 @@ func main() {
fingerprint := sha256.Sum256(chain[0].Raw) fingerprint := sha256.Sum256(chain[0].Raw)
for _, ctlog := range logs { for _, ctlog := range logs {
wg.Add(1) wg.Add(1)
go func(ctlog Log) { go func(index int, ctlog Log) {
sct, err := ctlog.SubmitChain(chain) sct, err := ctlog.SubmitChain(chain)
if err != nil { if err != nil {
log.Printf("%x: %s: Submission Error: %s", fingerprint, ctlog.info.Url, err) log.Printf("%x [%d]: %s: Submission Error: %s", fingerprint, index, ctlog.info.Url, err)
atomic.AddUint32(&submitErrors, 1) atomic.AddUint32(&submitErrors, 1)
} else if *verbose { } else if *verbose {
timestamp := time.Unix(int64(sct.Timestamp)/1000, int64(sct.Timestamp%1000)*1000000) timestamp := time.Unix(int64(sct.Timestamp)/1000, int64(sct.Timestamp%1000)*1000000)
log.Printf("%x: %s: Submitted at %s", fingerprint, ctlog.info.Url, timestamp) log.Printf("%x [%d]: %s: Submitted at %s", fingerprint, index, ctlog.info.Url, timestamp)
} }
wg.Done() wg.Done()
}(ctlog) }(index, ctlog)
} }
} }
wg.Wait() wg.Wait()