libeech

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

commit d1b10606edf81df3f81e863bca63384d9bc44ae3
parent f95c99456e8f5cfa576199c8006fd8898ca1e182
Author: z3bra <contactatz3bradotorg>
Date:   Sun Jul  1 13:23:15 +0200

Start implementing pwprxpc()

Diffstat:
libeech.c | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/libeech.c b/libeech.c @@ -585,6 +585,22 @@ pwprxrq(struct torrent *t, struct peer *p, size_t sz, char *pl) static int pwprxpc(struct torrent *t, struct peer *p, size_t sz, char *pl) { + size_t idx, off; + char *blk; + + idx = U32(pl); + off = U32(pl+4); + blk = pl + 8; + + memcpy(p->piece.blks + off, blk, sz - 8); + + if (chkpiece(t, &p->piece, idx)) { + printf("PIECE: hash OK, piece full"); + /* writepiece(t, p->piece, idx); */ + } else { + printf("PIECE: has doesn't match (yet)"); + } + return 0; }