Commit 4333d382 authored by Mikio Hara's avatar Mikio Hara

net: fix typo in error message of TCPConn.ReadFrom

On some error when using io.Copy with TCPConn, it displays an error
correlation like the following:

read tcp 192.0.2.1:1111->192.0.2.2:2222: read tcp [2001:db8::2]:2222->[2001:db8::3]:3333 read: connection reset by peer

the correlation "some error on reading after reading operation" looks a
bit confusing because the operation on the ReadFrom method of TCPConn is
actually "writing after reading." To clarify and avoid confusion, this
change sets "readfrom" to the Op field of outer-most OpError instead of
"read."

Change-Id: I6bf4e2e7247143fa54bbcf9cef7a8ae1ede1b35c
Reviewed-on: https://go-review.googlesource.com/25220Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent fe251d25
......@@ -81,7 +81,7 @@ func (c *TCPConn) ReadFrom(r io.Reader) (int64, error) {
}
n, err := c.readFrom(r)
if err != nil && err != io.EOF {
err = &OpError{Op: "read", Net: c.fd.net, Source: c.fd.laddr, Addr: c.fd.raddr, Err: err}
err = &OpError{Op: "readfrom", Net: c.fd.net, Source: c.fd.laddr, Addr: c.fd.raddr, Err: err}
}
return n, err
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment