finishRead clears the read timeout and reports whether the connection or operation context ended while the read was in progress.
(ctx context.Context, err *error, timeoutSet bool)
| 242 | // finishRead clears the read timeout and reports whether the connection or |
| 243 | // operation context ended while the read was in progress. |
| 244 | func (c *Conn) finishRead(ctx context.Context, err *error, timeoutSet bool) { |
| 245 | if timeoutSet { |
| 246 | c.clearReadTimeout() |
| 247 | } |
| 248 | select { |
| 249 | case <-c.closed: |
| 250 | if *err != nil { |
| 251 | *err = net.ErrClosed |
| 252 | } |
| 253 | default: |
| 254 | } |
| 255 | if *err != nil && ctx.Err() != nil { |
| 256 | *err = ctx.Err() |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | func (c *Conn) readFrameHeader(ctx context.Context) (_ header, err error) { |
| 261 | timeoutSet, err := c.prepareRead(ctx) |
no test coverage detected