readFromUntil reads from r into c.rawInput until c.rawInput contains at least n bytes or else returns an error.
(r io.Reader, n int)
| 897 | // readFromUntil reads from r into c.rawInput until c.rawInput contains |
| 898 | // at least n bytes or else returns an error. |
| 899 | func (c *Conn) readFromUntil(r io.Reader, n int) error { |
| 900 | if c.rawInput.Len() >= n { |
| 901 | return nil |
| 902 | } |
| 903 | needs := n - c.rawInput.Len() |
| 904 | // There might be extra input waiting on the wire. Make a best effort |
| 905 | // attempt to fetch it so that it can be used in (*Conn).Read to |
| 906 | // "predict" closeNotify alerts. |
| 907 | c.rawInput.Grow(needs + bytes.MinRead) |
| 908 | _, err := c.rawInput.ReadFrom(&atLeastReader{r, int64(needs)}) |
| 909 | return err |
| 910 | } |
| 911 | |
| 912 | // sendAlert sends a TLS alert message. |
| 913 | func (c *Conn) sendAlertLocked(err alert) error { |