diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2005-07-21 15:06:13 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2005-07-21 15:06:13 +0000 |
| commit | 2904cdca2d230155139680729bc11b033b4b4d93 (patch) | |
| tree | 3e19d6092e608f7dd557e857edbfafbfe9bcd02c | |
| parent | ce0e134bc4279f206ec8421c2f785f5149c2fa80 (diff) | |
| download | btpd-2904cdca2d230155139680729bc11b033b4b4d93.tar.gz btpd-2904cdca2d230155139680729bc11b033b4b4d93.zip | |
Add tests for correctness.
| -rw-r--r-- | btpd/peer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/btpd/peer.c b/btpd/peer.c index f40e3c1..8aecd0b 100644 --- a/btpd/peer.c +++ b/btpd/peer.c @@ -125,6 +125,7 @@ peer_choke(struct peer *p) void peer_want(struct peer *p, uint32_t index) { + assert(p->nwant < p->npieces); p->nwant++; if (p->nwant == 1) { p->flags |= PF_I_WANT; @@ -135,6 +136,7 @@ peer_want(struct peer *p, uint32_t index) void peer_unwant(struct peer *p, uint32_t index) { + assert(p->nwant > 0); p->nwant--; if (p->nwant == 0) { p->flags &= ~PF_I_WANT; |