tBroadcast HAVE messages when receiving a piece - libeech - bittorrent library
 (HTM) git clone git://z3bra.org/libeech.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 207bde90ffe79608f7ac5c69117bb379a9648903
 (DIR) parent e4776677ff079bc800b63a77587528bae051067b
 (HTM) Author: z3bra <contactatz3bradotorg>
       Date:   Wed,  4 Jul 2018 08:56:49 +0200
       
       Broadcast HAVE messages when receiving a piece
       
       Diffstat:
         M libeech.c                           |       6 +++++-
       
       1 file changed, 5 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/libeech.c b/libeech.c
       t@@ -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));
       t@@ -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;
        }