1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

don't use writer

This commit is contained in:
Zack Scholl 2018-09-26 11:11:19 -07:00
parent 8ddd7aff06
commit bc4bd2b0a8

View file

@ -40,14 +40,14 @@ func (c *Comm) Close() {
}
func (c *Comm) Write(b []byte) (int, error) {
c.writer.Write([]byte(fmt.Sprintf("%0.6d", len(b))))
n, err := c.writer.Write(b)
c.connection.Write([]byte(fmt.Sprintf("%0.6d", len(b))))
n, err := c.connection.Write(b)
if n != len(b) {
err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b))
}
if err == nil {
c.writer.Flush()
}
// if err == nil {
// c.writer.Flush()
// }
// log.Printf("wanted to write %d but wrote %d", n, len(b))
return n, err
}