diff --git a/conn.go b/conn.go index 6a03fa8..e6cee12 100644 --- a/conn.go +++ b/conn.go @@ -15,6 +15,7 @@ import ( "io" "net" "sync" + "time" ) // A Conn represents a secured connection. @@ -86,24 +87,23 @@ func (c *Conn) RemoteAddr() net.Addr { return c.conn.RemoteAddr() } -// SetTimeout sets the read deadline associated with the connection. +// SetDeadline sets the read deadline associated with the connection. // There is no write deadline. -func (c *Conn) SetTimeout(nsec int64) error { - return c.conn.SetTimeout(nsec) +// A zero value for t means Read will not time out. +func (c *Conn) SetDeadline(t time.Time) error { + return c.conn.SetDeadline(t) } -// SetReadTimeout sets the time (in nanoseconds) that -// Read will wait for data before returning a net.Error -// with Timeout() == true. -// Setting nsec == 0 (the default) disables the deadline. -func (c *Conn) SetReadTimeout(nsec int64) error { - return c.conn.SetReadTimeout(nsec) +// SetReadDeadline sets the read deadline on the underlying connection. +// A zero value for t means Read will not time out. +func (c *Conn) SetReadDeadline(t time.Time) error { + return c.conn.SetReadDeadline(t) } -// SetWriteTimeout exists to satisfy the net.Conn interface +// SetWriteDeadline exists to satisfy the net.Conn interface // but is not implemented by TLS. It always returns an error. -func (c *Conn) SetWriteTimeout(nsec int64) error { - return errors.New("TLS does not support SetWriteTimeout") +func (c *Conn) SetWriteDeadline(t time.Time) error { + return errors.New("TLS does not support SetWriteDeadline") } // A halfConn represents one direction of the record layer @@ -744,7 +744,7 @@ func (c *Conn) Write(b []byte) (n int, err error) { } // Read can be made to time out and return a net.Error with Timeout() == true -// after a fixed time limit; see SetTimeout and SetReadTimeout. +// after a fixed time limit; see SetDeadline and SetReadDeadline. func (c *Conn) Read(b []byte) (n int, err error) { if err = c.Handshake(); err != nil { return