|
|
@ -1,6 +1,7 @@
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"bufio"
|
|
|
|
"flag"
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
@ -79,13 +80,15 @@ func main() {
|
|
|
|
sent := make(chan value, options.buffer)
|
|
|
|
sent := make(chan value, options.buffer)
|
|
|
|
go streamValues(infile, c)
|
|
|
|
go streamValues(infile, c)
|
|
|
|
go func() {
|
|
|
|
go func() {
|
|
|
|
|
|
|
|
w := bufio.NewWriterSize(conn, 4048)
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
close(sent)
|
|
|
|
close(sent)
|
|
|
|
fmt.Println("All data transferred. Waiting for the last reply...")
|
|
|
|
fmt.Println("All data transferred. Waiting for the last reply...")
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
for r := range c {
|
|
|
|
for r := range c {
|
|
|
|
if r.ok() {
|
|
|
|
if r.ok() {
|
|
|
|
r.val().Write(conn)
|
|
|
|
r.val().Write(w)
|
|
|
|
|
|
|
|
w.Flush()
|
|
|
|
sent <- r.val()
|
|
|
|
sent <- r.val()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fmt.Fprintf(os.Stderr, "InputError: %v\n", r.err())
|
|
|
|
fmt.Fprintf(os.Stderr, "InputError: %v\n", r.err())
|
|
|
|