(t time.Time)
| 275 | } |
| 276 | |
| 277 | func (c *conn) SetReadDeadline(t time.Time) error { |
| 278 | p := c.Reader.(*pipe) |
| 279 | p.mu.Lock() |
| 280 | defer p.mu.Unlock() |
| 281 | p.rtimer.Stop() |
| 282 | p.rtimedout = false |
| 283 | if !t.IsZero() { |
| 284 | p.rtimer = time.AfterFunc(time.Until(t), func() { |
| 285 | p.mu.Lock() |
| 286 | defer p.mu.Unlock() |
| 287 | p.rtimedout = true |
| 288 | p.rwait.Broadcast() |
| 289 | }) |
| 290 | } |
| 291 | return nil |
| 292 | } |
| 293 | |
| 294 | func (c *conn) SetWriteDeadline(t time.Time) error { |
| 295 | p := c.Writer.(*pipe) |