Skip to content

Commit

Permalink
fix logging problem with peerid
Browse files Browse the repository at this point in the history
  • Loading branch information
majestrate committed Aug 16, 2017
1 parent 26336e0 commit 549c937
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xd/lib/bittorrent/swarm/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,18 @@ func (sw *Swarm) inboundConn(c net.Conn) {
opts = extensions.New()
}
// reply to handshake
var id common.PeerID
copy(id[:], h.PeerID[:])
copy(h.PeerID[:], sw.id[:])
err = h.Send(c)

if err != nil {
log.Warnf("didn't send bittorrent handshake reply: %s, closing connection", err)
// write error
c.Close()
return
}
// make peer conn
p := makePeerConn(c, t, h.PeerID, opts)
p := makePeerConn(c, t, id, opts)

go p.runWriter()
go p.runReader()
Expand Down

0 comments on commit 549c937

Please sign in to comment.