add stream deadlines to the Stream interface

This commit is contained in:
Marten Seemann
2017-06-11 15:43:52 +02:00
parent 1acdc5f18e
commit e09993403d
4 changed files with 19 additions and 11 deletions

View File

@@ -304,9 +304,6 @@ func (s *stream) signalWrite() {
}
}
// SetReadDeadline sets the deadline for future Read calls and
// any currently-blocked Read call.
// A zero value for t means Read will not time out.
func (s *stream) SetReadDeadline(t time.Time) error {
s.mutex.Lock()
oldDeadline := s.readDeadline
@@ -319,11 +316,6 @@ func (s *stream) SetReadDeadline(t time.Time) error {
return nil
}
// SetWriteDeadline sets the deadline for future Write calls
// and any currently-blocked Write call.
// Even if write times out, it may return n > 0, indicating that
// some of the data was successfully written.
// A zero value for t means Write will not time out.
func (s *stream) SetWriteDeadline(t time.Time) error {
s.mutex.Lock()
oldDeadline := s.writeDeadline
@@ -335,9 +327,6 @@ func (s *stream) SetWriteDeadline(t time.Time) error {
return nil
}
// SetDeadline sets the read and write deadlines associated
// with the connection. It is equivalent to calling both
// SetReadDeadline and SetWriteDeadline.
func (s *stream) SetDeadline(t time.Time) error {
_ = s.SetReadDeadline(t) // SetReadDeadline never errors
_ = s.SetWriteDeadline(t) // SetWriteDeadline never errors