libeech

BitTorrent library
git clone git://z3bra.org/libeech.git
Log | Files | Refs | README | LICENSE

commit 207bde90ffe79608f7ac5c69117bb379a9648903
parent e4776677ff079bc800b63a77587528bae051067b
Author: z3bra <contactatz3bradotorg>
Date:   Wed Jul  4 08:56:49 +0200

Broadcast HAVE messages when receiving a piece

Diffstat:
libeech.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libeech.c b/libeech.c @@ -609,6 +609,7 @@ pwprxpc(struct torrent *t, struct peer *p, size_t sz, char *pl) { size_t idx, off; char *blk; + struct peer *b; idx = ntohl(U32(pl+1)); off = ntohl(U32(pl+5)); @@ -616,8 +617,11 @@ pwprxpc(struct torrent *t, struct peer *p, size_t sz, char *pl) memcpy(p->piece.blks + off, blk, sz - 8); - if (!chkpiece(t, &p->piece, idx) && !writepiece(t, &(p->piece))) + if (!chkpiece(t, &p->piece, idx) && !writepiece(t, &(p->piece))) { setbit(t->bf, p->piece.n); + for (b = t->peers; b; b = b->next) + pwptxhv(b, p->piece.n); + } return 0; }