hmgle/graftcp

wake up the blocking pipe goroutine

hmgle opened this issue · 0 comments

hmgle commented

func pipe(dst, src net.Conn, c chan int64) {
n, _ := io.Copy(dst, src)
c <- n
}

go pipe(conn, destConn, writeChan)
go pipe(destConn, conn, readChan)
<-writeChan
<-readChan
conn.Close()
will block until all io.Copy return.