tGroup leeching-related actions together - libeech - bittorrent library
 (HTM) git clone git://z3bra.org/libeech.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 115117034d00618ff235ffc27b60277035a0e759
 (DIR) parent 774c0676d1298d2731342468f3f53c0f4e5a9630
 (HTM) Author: z3bra <contactatz3bradotorg>
       Date:   Thu,  5 Jul 2018 08:14:42 +0200
       
       Group leeching-related actions together
       
       Diffstat:
         M libeech.c                           |      14 ++++++++------
       
       1 file changed, 8 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/libeech.c b/libeech.c
       t@@ -664,13 +664,15 @@ pwptx(struct torrent *t, struct peer *p)
                        p->state |= HANDSHAKESENT;
                }
        
       -        if ((p->state & LEECHING) && !(p->state & AMINTERESTED)) {
       -                pwptxst(p, INTERESTED);
       -                p->state |= AMINTERESTED;
       -        }
       +        if (p->state & LEECHING) {
       +                if (!(p->state & AMINTERESTED)) {
       +                        pwptxst(p, INTERESTED);
       +                        p->state |= AMINTERESTED;
       +                }
        
       -        if ((p->state & LEECHING) && !(p->state & AMCHOKING) && p->piece.n < 0)
       -                pwptxrq(t, p);
       +                if (!(p->state & AMCHOKING) && p->piece.n < 0)
       +                        pwptxrq(t, p);
       +        }
        
                return 0;
        }