From 19e05b901a1ee74fd080878c388924855ea9dbcd Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Wed, 22 Jun 2016 10:32:42 -0700 Subject: [PATCH] Remove some dead code from the scanner --- cmd/common.go | 2 -- scanner.go | 27 +++------------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/cmd/common.go b/cmd/common.go index a5379f1..b3a06a3 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -29,7 +29,6 @@ import ( var batchSize = flag.Int("batch_size", 1000, "Max number of entries to request at per call to get-entries") var numWorkers = flag.Int("num_workers", 2, "Number of concurrent matchers") -var parallelFetch = flag.Int("parallel_fetch", 2, "Number of concurrent GetEntries fetches") var script = flag.String("script", "", "Script to execute when a matching certificate is found") var logsFilename = flag.String("logs", "", "JSON file containing log URLs") var underwater = flag.Bool("underwater", false, "Monitor certificates from distrusted CAs instead of trusted CAs") @@ -186,7 +185,6 @@ func Main (argStateDir string, processCallback certspotter.ProcessCallback) int opts := certspotter.ScannerOptions{ BatchSize: *batchSize, NumWorkers: *numWorkers, - ParallelFetch: *parallelFetch, Quiet: !*verbose, } scanner := certspotter.NewScanner(logUri, logKey, &opts) diff --git a/scanner.go b/scanner.go index 532b517..6b5289d 100644 --- a/scanner.go +++ b/scanner.go @@ -6,6 +6,9 @@ // // This software is distributed WITHOUT A WARRANTY OF ANY KIND. // See the Mozilla Public License for details. +// +// This file contains code from https://github.com/google/certificate-transparency/tree/master/go +// See ct/AUTHORS and ct/LICENSE for copyright and license information. package certspotter @@ -38,9 +41,6 @@ type ScannerOptions struct { // Number of concurrent proecssors to run NumWorkers int - // Number of concurrent fethers to run - ParallelFetch int - // Don't print any status messages to stdout Quiet bool } @@ -50,7 +50,6 @@ func DefaultScannerOptions() *ScannerOptions { return &ScannerOptions{ BatchSize: 1000, NumWorkers: 1, - ParallelFetch: 1, Quiet: false, } } @@ -260,26 +259,6 @@ func (s *Scanner) Scan(startIndex int64, endIndex int64, processCert ProcessCall go s.processerJob(w, jobs, processCert, &processorWG) } - // Start fetcher workers - /* parallel fetcher - disabled for now because it complicates tree building - var ranges list.List - for start := startIndex; start < int64(endIndex); { - end := min(start+int64(s.opts.BatchSize), int64(endIndex)) - 1 - ranges.PushBack(fetchRange{start, end}) - start = end + 1 - } - var fetcherWG sync.WaitGroup - fetches := make(chan fetchRange, 1000) - for w := 0; w < s.opts.ParallelFetch; w++ { - fetcherWG.Add(1) - go s.fetcherJob(w, fetches, jobs, &fetcherWG) - } - for r := ranges.Front(); r != nil; r = r.Next() { - fetches <- r.Value.(fetchRange) - } - close(fetches) - fetcherWG.Wait() - */ for start := startIndex; start < int64(endIndex); { end := min(start+int64(s.opts.BatchSize), int64(endIndex)) - 1 if err := s.fetch(fetchRange{start, end}, jobs, treeBuilder); err != nil {