Skip to content

Commit

Permalink
Ensure that all TODOs have an owner.
Browse files Browse the repository at this point in the history
In the future, all TODOs added either need a bug number (TODO(#NN)) or a
person's github user name. By default, I made irungentoo the owner of
all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner
of API TODOs.
  • Loading branch information
iphydf committed Sep 16, 2016
1 parent c0d84ab commit effad22
Show file tree
Hide file tree
Showing 32 changed files with 144 additions and 127 deletions.
4 changes: 2 additions & 2 deletions auto_tests/assoc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

START_TEST(test_basics)
{
/* TODO: real test */
/* TODO(irungentoo): real test */
uint8_t id[crypto_box_PUBLICKEYBYTES] = {1};
Assoc *assoc = new_Assoc_default(NULL, id);
ck_assert_msg(assoc != NULL, "failed to create default assoc");
Expand Down Expand Up @@ -61,7 +61,7 @@ END_TEST

START_TEST(test_fillup)
{
/* TODO: real test */
/* TODO(irungentoo): real test */
int i, j;
uint8_t id[crypto_box_PUBLICKEYBYTES];
//uint32_t a = current_time();
Expand Down
39 changes: 22 additions & 17 deletions auto_tests/messenger_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ START_TEST(test_m_delfriend)
REALLY_BIG_NUMBER);
}
END_TEST
/*

#if 0
START_TEST(test_m_addfriend)
{
char *good_data = "test";
Expand All @@ -129,30 +130,34 @@ START_TEST(test_m_addfriend)
int good_len = strlen(good_data);
int bad_len = strlen(bad_data);
int really_bad_len = (MAX_CRYPTO_PACKET_SIZE - crypto_box_PUBLICKEYBYTES
- crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES
+ crypto_box_ZEROBYTES + 100); */
/* TODO: Update this properly to latest master
if(m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, really_bad_len) != FAERR_TOOLONG)
- crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES
+ crypto_box_ZEROBYTES + 100);

/* TODO(irungentoo): Update this properly to latest master */
if (m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, really_bad_len) != FAERR_TOOLONG) {
ck_abort_msg("m_addfriend did NOT catch the following length: %d\n", really_bad_len);
*/
/* this will return an error if the original m_addfriend_norequest() failed */
/* if(m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, good_len) != FAERR_ALREADYSENT)
}

/* this will return an error if the original m_addfriend_norequest() failed */
if (m_addfriend(m, (uint8_t *)friend_id, (uint8_t *)good_data, good_len) != FAERR_ALREADYSENT) {
ck_abort_msg("m_addfriend did NOT catch adding a friend we already have.\n"
"(this can be caused by the error of m_addfriend_norequest in"
" the beginning of the suite)\n");
}

if(m_addfriend(m, (uint8_t *)good_id_b, (uint8_t *)bad_data, bad_len) != FAERR_NOMESSAGE)
if (m_addfriend(m, (uint8_t *)good_id_b, (uint8_t *)bad_data, bad_len) != FAERR_NOMESSAGE) {
ck_abort_msg("m_addfriend did NOT catch the following length: %d\n", bad_len);
*/
/* this should REALLY return an error */
/*
* TODO: validate client_id in m_addfriend?
if(m_addfriend((uint8_t *)bad_id, (uint8_t *)good_data, good_len) >= 0)
ck_abort_msg("The following ID passed through "
"m_addfriend without an error:\n'%s'\n", bad_id_str);
}

/* this should REALLY return an error */
/* TODO(irungentoo): validate client_id in m_addfriend? */
if (m_addfriend((uint8_t *)bad_id, (uint8_t *)good_data, good_len) >= 0) {
ck_abort_msg("The following ID passed through "
"m_addfriend without an error:\n'%s'\n", bad_id_str);
}
}
END_TEST */
END_TEST
#endif

START_TEST(test_setname)
{
Expand Down
2 changes: 1 addition & 1 deletion auto_tests/toxav_basic_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ START_TEST(test_AV_flows)
} \
BobCC.incoming = false; \
} else { \
/* TODO rtp */ \
/* TODO(mannol): rtp */ \
\
if (time(NULL) - start_time >= 1) { \
\
Expand Down
2 changes: 1 addition & 1 deletion docs/Group-Chats.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ the invite or responds with a response packet if he wants to join the chat. The
of groupchat (text only, A/V) the friend is being invited to.


TODO: write more of this.
TODO(irungentoo): write more of this.

## Protocol

Expand Down
4 changes: 2 additions & 2 deletions other/apidsl/tox.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const MAX_FRIEND_REQUEST_LENGTH = 1016;
const MAX_MESSAGE_LENGTH = 1372;

/**
* Maximum size of custom packets. TODO: should be LENGTH?
* Maximum size of custom packets. TODO(iphydf): should be LENGTH?
*/
const MAX_CUSTOM_PACKET_SIZE = 1373;

Expand Down Expand Up @@ -786,7 +786,7 @@ inline namespace self {
* amounts of time. Clients should therefore not immediately bootstrap on
* receiving a disconnect.
*
* TODO: how long should a client wait before bootstrapping again?
* TODO(iphydf): how long should a client wait before bootstrapping again?
*/
event connection_status const {
/**
Expand Down
2 changes: 1 addition & 1 deletion other/apidsl/toxav.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ namespace video {

%{
/**
* NOTE Compatibility with old toxav group calls TODO remove
* NOTE Compatibility with old toxav group calls. TODO(iphydf): remove
*/
/* Create a new toxav group.
*
Expand Down
6 changes: 3 additions & 3 deletions testing/DHT_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static void print_friendlist(DHT *dht)
}
}

#if 0 /* slvrTODO: */
#if 0 /* TODO(slvr): */
static void printpacket(uint8_t *data, uint32_t length, IP_Port ip_port)
{
uint32_t i;
Expand Down Expand Up @@ -232,7 +232,7 @@ int main(int argc, char *argv[])
return 1;
}

#if 0 /* slvrTODO: */
#if 0 /* TODO(slvr): */
IP_Port ip_port;
uint8_t data[MAX_UDP_PACKET_SIZE];
uint32_t length;
Expand All @@ -241,7 +241,7 @@ int main(int argc, char *argv[])
while (1) {
do_DHT(dht);

#if 0 /* slvrTODO: */
#if 0 /* TODO(slvr): */

while (receivepacket(&ip_port, data, &length) != -1) {
if (DHT_handlepacket(data, length, ip_port) && friendreq_handlepacket(data, length, ip_port)) {
Expand Down
2 changes: 1 addition & 1 deletion testing/Messenger_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type
m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, 0);
}

/* FIXME needed as print_request has to match the interface expected by
/* TODO(irungentoo): needed as print_request has to match the interface expected by
* networking_requesthandler and so cannot take a Messenger * */
static Messenger *m;

Expand Down
2 changes: 1 addition & 1 deletion toxav/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void ac_iterate(ACSession *ac)
return;
}

/* TODO fix this and jitter buffering */
/* TODO(mannol): fix this and jitter buffering */

/* Enough space for the maximum frame size (120 ms 48 KHz stereo audio) */
int16_t tmp[5760 * 2];
Expand Down
4 changes: 2 additions & 2 deletions toxav/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ int group_send_audio(Group_Chats *g_c, int groupnumber, const int16_t *pcm, unsi
group_av->audio_sample_rate = sample_rate;

if (channels == 1) {
group_av->audio_bitrate = 32000; //TODO: add way of adjusting bitrate
group_av->audio_bitrate = 32000; // TODO(mannol): add way of adjusting bitrate
} else {
group_av->audio_bitrate = 64000; //TODO: add way of adjusting bitrate
group_av->audio_bitrate = 64000; // TODO(mannol): add way of adjusting bitrate
}

if (recreate_encoder(group_av) == -1) {
Expand Down
2 changes: 1 addition & 1 deletion toxav/toxav.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ bool audio_bit_rate_invalid(uint32_t bit_rate)
bool video_bit_rate_invalid(uint32_t bit_rate)
{
(void) bit_rate;
/* TODO: If anyone knows the answer to this one please fill it up */
/* TODO(mannol): If anyone knows the answer to this one please fill it up */
return false;
}
bool invoke_call_state_callback(ToxAV *av, uint32_t friend_number, uint32_t state)
Expand Down
2 changes: 1 addition & 1 deletion toxav/toxav.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ typedef void toxav_video_receive_frame_cb(ToxAV *av, uint32_t friend_number, uin
void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb *callback, void *user_data);

/**
* NOTE Compatibility with old toxav group calls TODO remove
* NOTE Compatibility with old toxav group calls. TODO(iphydf): remove
*/
/* Create a new toxav group.
*
Expand Down
8 changes: 5 additions & 3 deletions toxav/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ VCSession *vc_new(Logger *log, ToxAV *av, uint32_t friend_number, toxav_video_re
cfg.g_w = 800;
cfg.g_h = 600;
cfg.g_pass = VPX_RC_ONE_PASS;
/* FIXME If we set error resilience the app will crash due to bug in vp8.
Perhaps vp9 has solved it?*/
// cfg.g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT | VPX_ERROR_RESILIENT_PARTITIONS;
/* TODO(mannol): If we set error resilience the app will crash due to bug in vp8.
Perhaps vp9 has solved it?*/
#if 0
cfg.g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT | VPX_ERROR_RESILIENT_PARTITIONS;
#endif
cfg.g_lag_in_frames = 0;
cfg.kf_min_dist = 0;
cfg.kf_max_dist = 48;
Expand Down
51 changes: 28 additions & 23 deletions toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port)
uint8_t net_family;

if (ip_port->ip.family == AF_INET) {
// FIXME use functions to convert endianness
// TODO(irungentoo): use functions to convert endianness
ipv6 = 0;
net_family = TOX_AF_INET;
} else if (ip_port->ip.family == TCP_INET) {
Expand Down Expand Up @@ -432,7 +432,7 @@ int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed
/* Check if client with public_key is already in list of length length.
* If it is then set its corresponding timestamp to current time.
* If the id is already in the list with a different ip_port, update it.
* TODO: Maybe optimize this.
* TODO(irungentoo): Maybe optimize this.
*
* return True(1) or False(0)
*/
Expand Down Expand Up @@ -482,7 +482,7 @@ static int client_or_ip_port_in_list(Logger *log, Client_data *list, uint16_t le

/* public_key not in list yet: see if we can find an identical ip_port, in
* that case we kill the old public_key by overwriting it with the new one
* TODO: maybe we SHOULDN'T do that if that public_key is in a friend_list
* TODO(irungentoo): maybe we SHOULDN'T do that if that public_key is in a friend_list
* and the one who is the actual friend's public_key/address set? */
for (i = 0; i < length; ++i) {
/* MAYBE: check the other address, if valid, don't nuke? */
Expand Down Expand Up @@ -576,7 +576,7 @@ bool add_to_list(Node_format *nodes_list, unsigned int length, const uint8_t *pk
return 0;
}

/*TODO: change this to 7 when done*/
/* TODO(irungentoo): change this to 7 when done*/
#define HARDENING_ALL_OK 2
/* return 0 if not.
* return 1 if route request are ok
Expand Down Expand Up @@ -657,8 +657,8 @@ static void get_close_nodes_inner(const uint8_t *public_key, Node_format *nodes_
/* Find MAX_SENT_NODES nodes closest to the public_key for the send nodes request:
* put them in the nodes_list and return how many were found.
*
* TODO: For the love of based <your favorite deity, in doubt use "love"> make
* this function cleaner and much more efficient.
* TODO(irungentoo): For the love of based <your favorite deity, in doubt use
* "love"> make this function cleaner and much more efficient.
*
* want_good : do we want only good nodes as checked with the hardening returned or not?
*/
Expand All @@ -669,12 +669,17 @@ static int get_somewhat_close_nodes(const DHT *dht, const uint8_t *public_key, N
get_close_nodes_inner(public_key, nodes_list, sa_family,
dht->close_clientlist, LCLIENT_LIST, &num_nodes, is_LAN, 0);

/*TODO uncomment this when hardening is added to close friend clients
for (i = 0; i < dht->num_friends; ++i)
get_close_nodes_inner(dht, public_key, nodes_list, sa_family,
dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS,
&num_nodes, is_LAN, want_good);
*/
/* TODO(irungentoo): uncomment this when hardening is added to close friend clients */
#if 0

for (i = 0; i < dht->num_friends; ++i) {
get_close_nodes_inner(dht, public_key, nodes_list, sa_family,
dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS,
&num_nodes, is_LAN, want_good);
}

#endif

for (i = 0; i < dht->num_friends; ++i) {
get_close_nodes_inner(public_key, nodes_list, sa_family,
dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS,
Expand All @@ -695,7 +700,7 @@ int get_close_nodes(const DHT *dht, const uint8_t *public_key, Node_format *node
return get_somewhat_close_nodes(dht, public_key, nodes_list, sa_family, is_LAN, want_good);

#ifdef ENABLE_ASSOC_DHT
//TODO: assoc, sa_family 0 (don't care if ipv4 or ipv6) support.
// TODO(irungentoo): assoc, sa_family 0 (don't care if ipv4 or ipv6) support.
Client_data *result[MAX_SENT_NODES];

Assoc_close_entries request;
Expand Down Expand Up @@ -970,7 +975,7 @@ static unsigned int ping_node_from_getnodes_ok(DHT *dht, const uint8_t *public_k
dht->to_bootstrap[dht->num_to_bootstrap].ip_port = ip_port;
++dht->num_to_bootstrap;
} else {
//TODO: ipv6 vs v4
// TODO(irungentoo): ipv6 vs v4
add_to_list(dht->to_bootstrap, MAX_CLOSE_TO_BOOTSTRAP_NODES, public_key, ip_port, dht->self_public_key);
}
}
Expand Down Expand Up @@ -1536,7 +1541,7 @@ int DHT_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count)
return 0;
}

/* TODO: Optimize this. */
/* TODO(irungentoo): Optimize this. */
int DHT_getfriendip(const DHT *dht, const uint8_t *public_key, IP_Port *ip_port)
{
uint32_t i, j;
Expand Down Expand Up @@ -2113,7 +2118,7 @@ static void punch_holes(DHT *dht, IP ip, uint16_t *port_list, uint16_t numports,
send_ping_request(dht->ping, pinging, dht->friends_list[friend_num].public_key);
} else {
for (i = dht->friends_list[friend_num].nat.punching_index; i != top; ++i) {
/* TODO: Improve port guessing algorithm. */
/* TODO(irungentoo): Improve port guessing algorithm. */
uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
IP_Port pinging;
ip_copy(&pinging.ip, &ip);
Expand Down Expand Up @@ -2246,7 +2251,7 @@ static int send_hardening_getnode_res(const DHT *dht, const Node_format *sendto,
return sendpacket(dht->net, sendto->ip_port, packet, len);
}

/* TODO: improve */
/* TODO(irungentoo): improve */
static IPPTsPng *get_closelist_IPPTsPng(DHT *dht, const uint8_t *public_key, sa_family_t sa_family)
{
uint32_t i;
Expand All @@ -2270,7 +2275,7 @@ static IPPTsPng *get_closelist_IPPTsPng(DHT *dht, const uint8_t *public_key, sa_

/*
* check how many nodes in nodes are also present in the closelist.
* TODO: make this function better.
* TODO(irungentoo): make this function better.
*/
static uint32_t have_nodes_closelist(DHT *dht, Node_format *nodes, uint16_t num)
{
Expand Down Expand Up @@ -2340,7 +2345,7 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_
Node_format nodes[MAX_SENT_NODES];
int num_nodes = unpack_nodes(nodes, MAX_SENT_NODES, 0, packet + 1 + crypto_box_PUBLICKEYBYTES, length_nodes, 0);

/* TODO: MAX_SENT_NODES nodes should be returned at all times
/* TODO(irungentoo): MAX_SENT_NODES nodes should be returned at all times
(right now we have a small network size so it could cause problems for testing and etc..) */
if (num_nodes <= 0) {
return 1;
Expand Down Expand Up @@ -2376,7 +2381,7 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_

#if DHT_HARDENING
/* Return a random node from all the nodes we are connected to.
* TODO: improve this function.
* TODO(irungentoo): improve this function.
*/
static Node_format random_node(DHT *dht, sa_family_t sa_family)
{
Expand Down Expand Up @@ -2515,7 +2520,7 @@ static void do_hardening(DHT *dht)
to_test.ip_port = cur_iptspng->ip_port;
memcpy(to_test.public_key, public_key, crypto_box_PUBLICKEYBYTES);

//TODO: The search id should maybe not be ours?
// TODO(irungentoo): The search id should maybe not be ours?
if (send_hardening_getnode_req(dht, &rand_node, &to_test, dht->self_public_key) > 0) {
memcpy(cur_iptspng->hardening.send_nodes_pingedid, rand_node.public_key, crypto_box_PUBLICKEYBYTES);
cur_iptspng->hardening.send_nodes_timestamp = unix_time();
Expand All @@ -2527,7 +2532,7 @@ static void do_hardening(DHT *dht)
}
}

//TODO: add the 2 other testers.
// TODO(irungentoo): add the 2 other testers.
}
}
#endif
Expand Down Expand Up @@ -2681,7 +2686,7 @@ void kill_DHT(DHT *dht)
}

/* new DHT format for load/save, more robust and forward compatible */
//TODO: Move this closer to Messenger.
// TODO(irungentoo): Move this closer to Messenger.
#define DHT_STATE_COOKIE_GLOBAL 0x159000d

#define DHT_STATE_COOKIE_TYPE 0x11ce
Expand Down
2 changes: 1 addition & 1 deletion toxcore/DHT.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ bool node_addable_to_close_list(DHT *dht, const uint8_t *public_key, IP_Port ip_
*
* sa_family = family (IPv4 or IPv6) (0 if we don't care)?
* is_LAN = return some LAN ips (true or false)
* want_good = do we want tested nodes or not? (TODO)
* want_good = do we want tested nodes or not? (TODO(irungentoo))
*
* return the number of nodes returned.
*
Expand Down
Loading

0 comments on commit effad22

Please sign in to comment.