|
|
@ -150,6 +150,25 @@ func (c *chunk) send(w *bufio.Writer, responses chan maybe) *sendResult {
|
|
|
|
return stats
|
|
|
|
return stats
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func infile() *os.File {
|
|
|
|
|
|
|
|
if options.pipe {
|
|
|
|
|
|
|
|
return os.Stdin
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args := flag.Args()
|
|
|
|
|
|
|
|
if len(args) < 1 {
|
|
|
|
|
|
|
|
usage(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fname := args[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f, err := os.Open(fname)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "unable to open file %s: %v\n", fname, err)
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return f
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
flag.Parse()
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
|
|
|
@ -183,31 +202,13 @@ func main() {
|
|
|
|
defer pprof.StopCPUProfile()
|
|
|
|
defer pprof.StopCPUProfile()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var infile *os.File
|
|
|
|
f := infile()
|
|
|
|
|
|
|
|
|
|
|
|
if options.pipe {
|
|
|
|
|
|
|
|
infile = os.Stdin
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
args := flag.Args()
|
|
|
|
|
|
|
|
if len(args) < 1 {
|
|
|
|
|
|
|
|
usage(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fname := args[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
infile, err = os.Open(fname)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Printf("unable to open file %s: %v\n", fname, err)
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer infile.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
responses := make(chan maybe)
|
|
|
|
responses := make(chan maybe)
|
|
|
|
go streamValues(conn, responses)
|
|
|
|
go streamValues(conn, responses)
|
|
|
|
|
|
|
|
|
|
|
|
c := make(chan maybe)
|
|
|
|
c := make(chan maybe)
|
|
|
|
go streamValues(infile, c)
|
|
|
|
go streamValues(f, c)
|
|
|
|
|
|
|
|
|
|
|
|
w := bufio.NewWriterSize(conn, 16384)
|
|
|
|
w := bufio.NewWriterSize(conn, 16384)
|
|
|
|
|
|
|
|
|
|
|
|