|
|
@ -16,6 +16,7 @@ var options struct {
|
|
|
|
buffer int
|
|
|
|
buffer int
|
|
|
|
pipe bool
|
|
|
|
pipe bool
|
|
|
|
profile string
|
|
|
|
profile string
|
|
|
|
|
|
|
|
verbose bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func usage(status int) {
|
|
|
|
func usage(status int) {
|
|
|
@ -105,14 +106,21 @@ func main() {
|
|
|
|
replies, errors := 0, 0
|
|
|
|
replies, errors := 0, 0
|
|
|
|
responses := make(chan maybe)
|
|
|
|
responses := make(chan maybe)
|
|
|
|
go streamValues(conn, responses)
|
|
|
|
go streamValues(conn, responses)
|
|
|
|
for _ = range sent {
|
|
|
|
for request := range sent {
|
|
|
|
response := <-responses
|
|
|
|
response := <-responses
|
|
|
|
if response.ok() {
|
|
|
|
if response.ok() {
|
|
|
|
switch r := response.val().(type) {
|
|
|
|
switch r := response.val().(type) {
|
|
|
|
case Error:
|
|
|
|
case Error:
|
|
|
|
fmt.Fprintln(os.Stderr, r)
|
|
|
|
if options.verbose {
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "%q -> %q\n", request, response.val())
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fmt.Fprintln(os.Stderr, r)
|
|
|
|
|
|
|
|
}
|
|
|
|
errors++
|
|
|
|
errors++
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|
|
|
|
if options.verbose {
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stdout, "%q -> %q\n", request, response.val())
|
|
|
|
|
|
|
|
}
|
|
|
|
replies++
|
|
|
|
replies++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -130,6 +138,7 @@ func init() {
|
|
|
|
flag.IntVar(&options.buffer, "buffer", 0, "number of outstanding statements allowed before throttling")
|
|
|
|
flag.IntVar(&options.buffer, "buffer", 0, "number of outstanding statements allowed before throttling")
|
|
|
|
flag.BoolVar(&options.pipe, "pipe", false, "transfers input from stdin to server")
|
|
|
|
flag.BoolVar(&options.pipe, "pipe", false, "transfers input from stdin to server")
|
|
|
|
flag.StringVar(&options.profile, "profile", "", "pprof file output for performance debugging")
|
|
|
|
flag.StringVar(&options.profile, "profile", "", "pprof file output for performance debugging")
|
|
|
|
|
|
|
|
flag.BoolVar(&options.verbose, "v", false, "verbose mode (prints all requests and responses)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|