From e067bff5b3e6533ac97fe2edb790509a87f2afbf Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 21 Feb 2015 14:58:28 +1100 Subject: [PATCH] Comments --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index c5ad0dd1..ba689c91 100644 --- a/client.go +++ b/client.go @@ -830,6 +830,8 @@ func handshake(sock io.ReadWriteCloser, ih *InfoHash, peerID [20]byte) (res hand return } +// Wraps a raw connection and provides the interface we want for using the +// connection in the message loop. type peerConn struct { net.Conn } @@ -841,6 +843,7 @@ func (pc peerConn) Read(b []byte) (n int, err error) { err = fmt.Errorf("error setting read deadline: %s", err) } n, err = pc.Conn.Read(b) + // Convert common errors into io.EOF. if err != nil { if opError, ok := err.(*net.OpError); ok && opError.Op == "read" && opError.Err == syscall.ECONNRESET { err = io.EOF