libeech

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

commit 009a0a8e71b2c329bd722650daf254bf81d82e19
parent cdd7c5d525296210093f84fc0407f6bb0012a7c3
Author: z3bra <contactatz3bradotorg>
Date:   Sun Jul  1 12:55:16 +0200

Implement pwprxst, pwprxhv and pwprxbf

Diffstat:
libeech.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/libeech.c b/libeech.c @@ -519,18 +519,37 @@ pwprq(struct torrent *t, struct peer *p) static int pwprxst(struct peer *p, int type) { + switch (type) { + case CHOKE: + p->state |= AMCHOKING; + break; + case UNCHOKE: + p->state &= ~AMCHOKING; + break; + case INTERESTED: + p->state |= ISINTERESTED; + break; + case UNINTERESTED: + p->state &= ~ISINTERESTED; + break; + } return 0; } static int pwprxhv(struct peer *p, size_t sz, char *pl) { + if (sz != 4) + return -1; + + setbit(p->bf, U32(pl)); return 0; } static int pwprxbf(struct peer *p, size_t sz, char *pl) { + memcpy(p->bf, pl, sz); return 0; }