From: alex Date: Tue, 29 Mar 2022 03:14:08 +0000 (-0700) Subject: ... X-Git-Url: http://git.infiniteadaptability.org/?a=commitdiff_plain;h=1cfb6f895b960bbad2bc1ad6dcddb94bee5f1f92;p=seeder ... --- diff --git a/src/peer/choke.c b/src/peer/choke.c index cded0a3..0efb9d6 100644 --- a/src/peer/choke.c +++ b/src/peer/choke.c @@ -1,9 +1,15 @@ #include int peer_choke(int sock, struct peer *info) { - return -1; + unsigned char buf[5] = "\x00\x00\x00\x01"; + buf[4] = PEER_MESSAGE_CHOKE; + + return net_send(sock,info,buf,5); } int peer_unchoke(int sock, struct peer *info) { - return -1; + unsigned char buf[5] = "\x00\x00\x00\x01"; + buf[4] = PEER_MESSAGE_UNCHOKE; + + return net_send(sock,info,buf,5); } diff --git a/src/peer/interest.c b/src/peer/interest.c index e9033c7..b41e06f 100644 --- a/src/peer/interest.c +++ b/src/peer/interest.c @@ -1,9 +1,15 @@ #include int peer_interested(int sock, struct peer *info) { - return -1; + unsigned char buf[5] = "\x00\x00\x00\x01"; + buf[4] = PEER_MESSAGE_INTERESTED; + + return net_send(sock,info,buf,5); } int peer_not_interested(int sock, struct peer *info) { - return -1; + unsigned char buf[5] = "\x00\x00\x00\x01"; + buf[4] = PEER_MESSAGE_NOT_INTERESTED; + + return net_send(sock,info,buf,5); }