projects
/
btrtrc.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c3457b2
)
Comments
author
Matt Joiner <anacrolix@gmail.com>
Sat, 21 Feb 2015 03:58:28 +0000 (14:58 +1100)
committer
Matt Joiner <anacrolix@gmail.com>
Sat, 21 Feb 2015 03:58:28 +0000 (14:58 +1100)
client.go
patch
|
blob
|
history
diff --git
a/client.go
b/client.go
index c5ad0dd1399055a7de9c4125c1dbeeb8029097e4..ba689c91a8f3d0016e0f419a503c22d4ae92d44b 100644
(file)
--- 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