浏览代码

Add tests for correctness.

master
Richard Nyberg 20 年前
父节点
当前提交
2904cdca2d
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. +2
    -0
      btpd/peer.c

+ 2
- 0
btpd/peer.c 查看文件

@@ -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;


||||||
x
 
000:0
正在加载...
取消
保存