Make a timeout so that Conn.Err closes when the connection is lost

This commit is contained in:
raylu 2011-01-28 21:03:45 -05:00 committed by Alex Bramley
parent 2a3ff18d73
commit a19bce5998
1 changed files with 1 additions and 0 deletions

View File

@ -140,6 +140,7 @@ func (conn *Conn) Connect(host string, pass ...string) os.Error {
conn.io = bufio.NewReadWriter( conn.io = bufio.NewReadWriter(
bufio.NewReader(conn.sock), bufio.NewReader(conn.sock),
bufio.NewWriter(conn.sock)) bufio.NewWriter(conn.sock))
conn.sock.SetTimeout(300000000000) // 5 minutes
go conn.send() go conn.send()
go conn.recv() go conn.recv()