Last active
May 14, 2019 05:07
-
-
Save martinomburajr/2911c57bddce0790322d635afe3a50e7 to your computer and use it in GitHub Desktop.
Reader implementation in the net.Conn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Read implements the Conn Read method. | |
| func (c *conn) Read(b []byte) (int, error) { | |
| if !c.ok() { | |
| return 0, syscall.EINVAL | |
| } | |
| n, err := c.fd.Read(b) | |
| if err != nil && err != io.EOF { | |
| err = &OpError{Op: "read", | |
| Net: c.fd.net, | |
| Source: c.fd.laddr, | |
| Addr: c.fd.raddr, | |
| Err: err} | |
| } | |
| return n, err | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment