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

increase timeout

This commit is contained in:
Zack Scholl 2018-10-09 19:31:49 -07:00
parent 8d1783fdc3
commit b0164920c7

View file

@ -18,7 +18,7 @@ type Comm struct {
func New(c net.Conn) Comm { func New(c net.Conn) Comm {
c.SetReadDeadline(time.Now().Add(3 * time.Hour)) c.SetReadDeadline(time.Now().Add(3 * time.Hour))
c.SetDeadline(time.Now().Add(3 * time.Hour)) c.SetDeadline(time.Now().Add(3 * time.Hour))
c.SetWriteDeadline(time.Now().Add(5 * time.Second)) c.SetWriteDeadline(time.Now().Add(20 * time.Second))
return Comm{c} return Comm{c}
} }
@ -35,7 +35,7 @@ func (c Comm) Close() {
func (c Comm) Write(b []byte) (int, error) { func (c Comm) Write(b []byte) (int, error) {
n, err := c.connection.Write(append([]byte(fmt.Sprintf("%0.5d", len(b))), b...)) n, err := c.connection.Write(append([]byte(fmt.Sprintf("%0.5d", len(b))), b...))
if n != len(b)+5 { if n != len(b)+5 {
err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b)) err = fmt.Errorf("wanted to write %d but wrote %d", len(b), n)
} }
// log.Printf("wanted to write %d but wrote %d", n, len(b)) // log.Printf("wanted to write %d but wrote %d", n, len(b))
return n, err return n, err