From 1cfb6f895b960bbad2bc1ad6dcddb94bee5f1f92 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 28 Mar 2022 20:14:08 -0700 Subject: [PATCH] ... --- src/peer/choke.c | 10 ++++++++-- src/peer/interest.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) 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); } -- 2.30.2