]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Improve some log messages
authorMatt Joiner <anacrolix@gmail.com>
Thu, 25 Jan 2018 02:10:52 +0000 (13:10 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 25 Jan 2018 02:10:52 +0000 (13:10 +1100)
client.go
mse/mse.go

index 290ea711aaa7294dccc5a5ff4b6dc4d250272ff3..fba0b1e22e020ee95298ffaf05b7c701d2e77cab 100644 (file)
--- a/client.go
+++ b/client.go
@@ -848,7 +848,7 @@ func (cl *Client) runHandshookConn(c *connection, t *Torrent, outgoing bool) {
        cl.sendInitialMessages(c, t)
        err := c.mainReadLoop()
        if err != nil && cl.config.Debug {
-               log.Printf("error during connection loop: %s", err)
+               log.Printf("error during connection main read loop: %s", err)
        }
 }
 
index 9771507b3bd953f25436162a9aae06e11f41c1f8..898cd3d724ac8f287ac70f045732438076ffebeb 100644 (file)
@@ -175,20 +175,20 @@ func (h *handshake) postY(x *big.Int) error {
        return h.postWrite(paddedLeft(y.Bytes(), 96))
 }
 
-func (h *handshake) establishS() (err error) {
+func (h *handshake) establishS() error {
        x := newX()
        h.postY(&x)
        var b [96]byte
-       _, err = io.ReadFull(h.conn, b[:])
+       _, err := io.ReadFull(h.conn, b[:])
        if err != nil {
-               return
+               return fmt.Errorf("error reading Y: %s", err)
        }
        var Y, S big.Int
        Y.SetBytes(b[:])
        S.Exp(&Y, &x, &p)
        sBytes := S.Bytes()
        copy(h.s[96-len(sBytes):96], sBytes)
-       return
+       return nil
 }
 
 func newPadLen() int64 {