|
@@ -125,6 +125,7 @@ peer_choke(struct peer *p) |
|
|
void |
|
|
void |
|
|
peer_want(struct peer *p, uint32_t index) |
|
|
peer_want(struct peer *p, uint32_t index) |
|
|
{ |
|
|
{ |
|
|
|
|
|
assert(p->nwant < p->npieces); |
|
|
p->nwant++; |
|
|
p->nwant++; |
|
|
if (p->nwant == 1) { |
|
|
if (p->nwant == 1) { |
|
|
p->flags |= PF_I_WANT; |
|
|
p->flags |= PF_I_WANT; |
|
@@ -135,6 +136,7 @@ peer_want(struct peer *p, uint32_t index) |
|
|
void |
|
|
void |
|
|
peer_unwant(struct peer *p, uint32_t index) |
|
|
peer_unwant(struct peer *p, uint32_t index) |
|
|
{ |
|
|
{ |
|
|
|
|
|
assert(p->nwant > 0); |
|
|
p->nwant--; |
|
|
p->nwant--; |
|
|
if (p->nwant == 0) { |
|
|
if (p->nwant == 0) { |
|
|
p->flags &= ~PF_I_WANT; |
|
|
p->flags &= ~PF_I_WANT; |
|
|