summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-12 16:48:35 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-16 12:06:02 +0100
commit1494e474dde58ec6e446cdbfad9a8d89f6c4796c (patch)
treee454a18a0f61468d10833d8e80039d025f94f568 /toxcore
parent37c041f8159f7e89f2585243e9b8073f47d77fd1 (diff)
Ensure that all TODOs have an owner.
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.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/DHT.c51
-rw-r--r--toxcore/DHT.h2
-rw-r--r--toxcore/LAN_discovery.c2
-rw-r--r--toxcore/Messenger.c13
-rw-r--r--toxcore/Messenger.h6
-rw-r--r--toxcore/TCP_client.c2
-rw-r--r--toxcore/TCP_connection.c10
-rw-r--r--toxcore/TCP_connection.h4
-rw-r--r--toxcore/TCP_server.c4
-rw-r--r--toxcore/assoc.c2
-rw-r--r--toxcore/crypto_core.c6
-rw-r--r--toxcore/friend_requests.h2
-rw-r--r--toxcore/group.c31
-rw-r--r--toxcore/net_crypto.c24
-rw-r--r--toxcore/network.c7
-rw-r--r--toxcore/onion_client.c10
-rw-r--r--toxcore/tox.c10
-rw-r--r--toxcore/tox.h4
18 files changed, 100 insertions, 90 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index e7fd0a9d..2f078314 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -243,7 +243,7 @@ static int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port)
243 uint8_t net_family; 243 uint8_t net_family;
244 244
245 if (ip_port->ip.family == AF_INET) { 245 if (ip_port->ip.family == AF_INET) {
246 // FIXME use functions to convert endianness 246 // TODO(irungentoo): use functions to convert endianness
247 ipv6 = 0; 247 ipv6 = 0;
248 net_family = TOX_AF_INET; 248 net_family = TOX_AF_INET;
249 } else if (ip_port->ip.family == TCP_INET) { 249 } else if (ip_port->ip.family == TCP_INET) {
@@ -432,7 +432,7 @@ int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed
432/* Check if client with public_key is already in list of length length. 432/* Check if client with public_key is already in list of length length.
433 * If it is then set its corresponding timestamp to current time. 433 * If it is then set its corresponding timestamp to current time.
434 * If the id is already in the list with a different ip_port, update it. 434 * If the id is already in the list with a different ip_port, update it.
435 * TODO: Maybe optimize this. 435 * TODO(irungentoo): Maybe optimize this.
436 * 436 *
437 * return True(1) or False(0) 437 * return True(1) or False(0)
438 */ 438 */
@@ -482,7 +482,7 @@ static int client_or_ip_port_in_list(Logger *log, Client_data *list, uint16_t le
482 482
483 /* public_key not in list yet: see if we can find an identical ip_port, in 483 /* public_key not in list yet: see if we can find an identical ip_port, in
484 * that case we kill the old public_key by overwriting it with the new one 484 * that case we kill the old public_key by overwriting it with the new one
485 * TODO: maybe we SHOULDN'T do that if that public_key is in a friend_list 485 * TODO(irungentoo): maybe we SHOULDN'T do that if that public_key is in a friend_list
486 * and the one who is the actual friend's public_key/address set? */ 486 * and the one who is the actual friend's public_key/address set? */
487 for (i = 0; i < length; ++i) { 487 for (i = 0; i < length; ++i) {
488 /* MAYBE: check the other address, if valid, don't nuke? */ 488 /* MAYBE: check the other address, if valid, don't nuke? */
@@ -576,7 +576,7 @@ bool add_to_list(Node_format *nodes_list, unsigned int length, const uint8_t *pk
576 return 0; 576 return 0;
577} 577}
578 578
579/*TODO: change this to 7 when done*/ 579/* TODO(irungentoo): change this to 7 when done*/
580#define HARDENING_ALL_OK 2 580#define HARDENING_ALL_OK 2
581/* return 0 if not. 581/* return 0 if not.
582 * return 1 if route request are ok 582 * return 1 if route request are ok
@@ -657,8 +657,8 @@ static void get_close_nodes_inner(const uint8_t *public_key, Node_format *nodes_
657/* Find MAX_SENT_NODES nodes closest to the public_key for the send nodes request: 657/* Find MAX_SENT_NODES nodes closest to the public_key for the send nodes request:
658 * put them in the nodes_list and return how many were found. 658 * put them in the nodes_list and return how many were found.
659 * 659 *
660 * TODO: For the love of based <your favorite deity, in doubt use "love"> make 660 * TODO(irungentoo): For the love of based <your favorite deity, in doubt use
661 * this function cleaner and much more efficient. 661 * "love"> make this function cleaner and much more efficient.
662 * 662 *
663 * want_good : do we want only good nodes as checked with the hardening returned or not? 663 * want_good : do we want only good nodes as checked with the hardening returned or not?
664 */ 664 */
@@ -669,12 +669,17 @@ static int get_somewhat_close_nodes(const DHT *dht, const uint8_t *public_key, N
669 get_close_nodes_inner(public_key, nodes_list, sa_family, 669 get_close_nodes_inner(public_key, nodes_list, sa_family,
670 dht->close_clientlist, LCLIENT_LIST, &num_nodes, is_LAN, 0); 670 dht->close_clientlist, LCLIENT_LIST, &num_nodes, is_LAN, 0);
671 671
672 /*TODO uncomment this when hardening is added to close friend clients 672 /* TODO(irungentoo): uncomment this when hardening is added to close friend clients */
673 for (i = 0; i < dht->num_friends; ++i) 673#if 0
674 get_close_nodes_inner(dht, public_key, nodes_list, sa_family, 674
675 dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS, 675 for (i = 0; i < dht->num_friends; ++i) {
676 &num_nodes, is_LAN, want_good); 676 get_close_nodes_inner(dht, public_key, nodes_list, sa_family,
677 */ 677 dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS,
678 &num_nodes, is_LAN, want_good);
679 }
680
681#endif
682
678 for (i = 0; i < dht->num_friends; ++i) { 683 for (i = 0; i < dht->num_friends; ++i) {
679 get_close_nodes_inner(public_key, nodes_list, sa_family, 684 get_close_nodes_inner(public_key, nodes_list, sa_family,
680 dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS, 685 dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS,
@@ -695,7 +700,7 @@ int get_close_nodes(const DHT *dht, const uint8_t *public_key, Node_format *node
695 return get_somewhat_close_nodes(dht, public_key, nodes_list, sa_family, is_LAN, want_good); 700 return get_somewhat_close_nodes(dht, public_key, nodes_list, sa_family, is_LAN, want_good);
696 701
697#ifdef ENABLE_ASSOC_DHT 702#ifdef ENABLE_ASSOC_DHT
698 //TODO: assoc, sa_family 0 (don't care if ipv4 or ipv6) support. 703 // TODO(irungentoo): assoc, sa_family 0 (don't care if ipv4 or ipv6) support.
699 Client_data *result[MAX_SENT_NODES]; 704 Client_data *result[MAX_SENT_NODES];
700 705
701 Assoc_close_entries request; 706 Assoc_close_entries request;
@@ -970,7 +975,7 @@ static unsigned int ping_node_from_getnodes_ok(DHT *dht, const uint8_t *public_k
970 dht->to_bootstrap[dht->num_to_bootstrap].ip_port = ip_port; 975 dht->to_bootstrap[dht->num_to_bootstrap].ip_port = ip_port;
971 ++dht->num_to_bootstrap; 976 ++dht->num_to_bootstrap;
972 } else { 977 } else {
973 //TODO: ipv6 vs v4 978 // TODO(irungentoo): ipv6 vs v4
974 add_to_list(dht->to_bootstrap, MAX_CLOSE_TO_BOOTSTRAP_NODES, public_key, ip_port, dht->self_public_key); 979 add_to_list(dht->to_bootstrap, MAX_CLOSE_TO_BOOTSTRAP_NODES, public_key, ip_port, dht->self_public_key);
975 } 980 }
976 } 981 }
@@ -1536,7 +1541,7 @@ int DHT_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count)
1536 return 0; 1541 return 0;
1537} 1542}
1538 1543
1539/* TODO: Optimize this. */ 1544/* TODO(irungentoo): Optimize this. */
1540int DHT_getfriendip(const DHT *dht, const uint8_t *public_key, IP_Port *ip_port) 1545int DHT_getfriendip(const DHT *dht, const uint8_t *public_key, IP_Port *ip_port)
1541{ 1546{
1542 uint32_t i, j; 1547 uint32_t i, j;
@@ -2113,7 +2118,7 @@ static void punch_holes(DHT *dht, IP ip, uint16_t *port_list, uint16_t numports,
2113 send_ping_request(dht->ping, pinging, dht->friends_list[friend_num].public_key); 2118 send_ping_request(dht->ping, pinging, dht->friends_list[friend_num].public_key);
2114 } else { 2119 } else {
2115 for (i = dht->friends_list[friend_num].nat.punching_index; i != top; ++i) { 2120 for (i = dht->friends_list[friend_num].nat.punching_index; i != top; ++i) {
2116 /* TODO: Improve port guessing algorithm. */ 2121 /* TODO(irungentoo): Improve port guessing algorithm. */
2117 uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1); 2122 uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
2118 IP_Port pinging; 2123 IP_Port pinging;
2119 ip_copy(&pinging.ip, &ip); 2124 ip_copy(&pinging.ip, &ip);
@@ -2246,7 +2251,7 @@ static int send_hardening_getnode_res(const DHT *dht, const Node_format *sendto,
2246 return sendpacket(dht->net, sendto->ip_port, packet, len); 2251 return sendpacket(dht->net, sendto->ip_port, packet, len);
2247} 2252}
2248 2253
2249/* TODO: improve */ 2254/* TODO(irungentoo): improve */
2250static IPPTsPng *get_closelist_IPPTsPng(DHT *dht, const uint8_t *public_key, sa_family_t sa_family) 2255static IPPTsPng *get_closelist_IPPTsPng(DHT *dht, const uint8_t *public_key, sa_family_t sa_family)
2251{ 2256{
2252 uint32_t i; 2257 uint32_t i;
@@ -2270,7 +2275,7 @@ static IPPTsPng *get_closelist_IPPTsPng(DHT *dht, const uint8_t *public_key, sa_
2270 2275
2271/* 2276/*
2272 * check how many nodes in nodes are also present in the closelist. 2277 * check how many nodes in nodes are also present in the closelist.
2273 * TODO: make this function better. 2278 * TODO(irungentoo): make this function better.
2274 */ 2279 */
2275static uint32_t have_nodes_closelist(DHT *dht, Node_format *nodes, uint16_t num) 2280static uint32_t have_nodes_closelist(DHT *dht, Node_format *nodes, uint16_t num)
2276{ 2281{
@@ -2340,7 +2345,7 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_
2340 Node_format nodes[MAX_SENT_NODES]; 2345 Node_format nodes[MAX_SENT_NODES];
2341 int num_nodes = unpack_nodes(nodes, MAX_SENT_NODES, 0, packet + 1 + crypto_box_PUBLICKEYBYTES, length_nodes, 0); 2346 int num_nodes = unpack_nodes(nodes, MAX_SENT_NODES, 0, packet + 1 + crypto_box_PUBLICKEYBYTES, length_nodes, 0);
2342 2347
2343 /* TODO: MAX_SENT_NODES nodes should be returned at all times 2348 /* TODO(irungentoo): MAX_SENT_NODES nodes should be returned at all times
2344 (right now we have a small network size so it could cause problems for testing and etc..) */ 2349 (right now we have a small network size so it could cause problems for testing and etc..) */
2345 if (num_nodes <= 0) { 2350 if (num_nodes <= 0) {
2346 return 1; 2351 return 1;
@@ -2376,7 +2381,7 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_
2376 2381
2377#if DHT_HARDENING 2382#if DHT_HARDENING
2378/* Return a random node from all the nodes we are connected to. 2383/* Return a random node from all the nodes we are connected to.
2379 * TODO: improve this function. 2384 * TODO(irungentoo): improve this function.
2380 */ 2385 */
2381static Node_format random_node(DHT *dht, sa_family_t sa_family) 2386static Node_format random_node(DHT *dht, sa_family_t sa_family)
2382{ 2387{
@@ -2515,7 +2520,7 @@ static void do_hardening(DHT *dht)
2515 to_test.ip_port = cur_iptspng->ip_port; 2520 to_test.ip_port = cur_iptspng->ip_port;
2516 memcpy(to_test.public_key, public_key, crypto_box_PUBLICKEYBYTES); 2521 memcpy(to_test.public_key, public_key, crypto_box_PUBLICKEYBYTES);
2517 2522
2518 //TODO: The search id should maybe not be ours? 2523 // TODO(irungentoo): The search id should maybe not be ours?
2519 if (send_hardening_getnode_req(dht, &rand_node, &to_test, dht->self_public_key) > 0) { 2524 if (send_hardening_getnode_req(dht, &rand_node, &to_test, dht->self_public_key) > 0) {
2520 memcpy(cur_iptspng->hardening.send_nodes_pingedid, rand_node.public_key, crypto_box_PUBLICKEYBYTES); 2525 memcpy(cur_iptspng->hardening.send_nodes_pingedid, rand_node.public_key, crypto_box_PUBLICKEYBYTES);
2521 cur_iptspng->hardening.send_nodes_timestamp = unix_time(); 2526 cur_iptspng->hardening.send_nodes_timestamp = unix_time();
@@ -2527,7 +2532,7 @@ static void do_hardening(DHT *dht)
2527 } 2532 }
2528 } 2533 }
2529 2534
2530 //TODO: add the 2 other testers. 2535 // TODO(irungentoo): add the 2 other testers.
2531 } 2536 }
2532} 2537}
2533#endif 2538#endif
@@ -2681,7 +2686,7 @@ void kill_DHT(DHT *dht)
2681} 2686}
2682 2687
2683/* new DHT format for load/save, more robust and forward compatible */ 2688/* new DHT format for load/save, more robust and forward compatible */
2684//TODO: Move this closer to Messenger. 2689// TODO(irungentoo): Move this closer to Messenger.
2685#define DHT_STATE_COOKIE_GLOBAL 0x159000d 2690#define DHT_STATE_COOKIE_GLOBAL 0x159000d
2686 2691
2687#define DHT_STATE_COOKIE_TYPE 0x11ce 2692#define DHT_STATE_COOKIE_TYPE 0x11ce
diff --git a/toxcore/DHT.h b/toxcore/DHT.h
index c5cde320..28848a4d 100644
--- a/toxcore/DHT.h
+++ b/toxcore/DHT.h
@@ -325,7 +325,7 @@ bool node_addable_to_close_list(DHT *dht, const uint8_t *public_key, IP_Port ip_
325 * 325 *
326 * sa_family = family (IPv4 or IPv6) (0 if we don't care)? 326 * sa_family = family (IPv4 or IPv6) (0 if we don't care)?
327 * is_LAN = return some LAN ips (true or false) 327 * is_LAN = return some LAN ips (true or false)
328 * want_good = do we want tested nodes or not? (TODO) 328 * want_good = do we want tested nodes or not? (TODO(irungentoo))
329 * 329 *
330 * return the number of nodes returned. 330 * return the number of nodes returned.
331 * 331 *
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index 22ea466a..1c28756b 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -168,7 +168,7 @@ static void fetch_broadcast_info(uint16_t port)
168 close(sock); 168 close(sock);
169} 169}
170 170
171#else //TODO: Other platforms? 171#else // TODO(irungentoo): Other platforms?
172 172
173static void fetch_broadcast_info(uint16_t port) 173static void fetch_broadcast_info(uint16_t port)
174{ 174{
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 3488fcca..def05449 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1449,7 +1449,8 @@ int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin
1449 return -7; 1449 return -7;
1450 } 1450 }
1451 1451
1452 /* Prevent file sending from filling up the entire buffer preventing messages from being sent. TODO: remove */ 1452 /* Prevent file sending from filling up the entire buffer preventing messages from being sent.
1453 * TODO(irungentoo): remove */
1453 if (crypto_num_free_sendqueue_slots(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c, 1454 if (crypto_num_free_sendqueue_slots(m->net_crypto, friend_connection_crypt_connection_id(m->fr_c,
1454 m->friendlist[friendnumber].friendcon_id)) < MIN_SLOTS_FREE) { 1455 m->friendlist[friendnumber].friendcon_id)) < MIN_SLOTS_FREE) {
1455 return -6; 1456 return -6;
@@ -1458,7 +1459,7 @@ int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin
1458 int64_t ret = send_file_data_packet(m, friendnumber, filenumber, data, length); 1459 int64_t ret = send_file_data_packet(m, friendnumber, filenumber, data, length);
1459 1460
1460 if (ret != -1) { 1461 if (ret != -1) {
1461 //TODO record packet ids to check if other received complete file. 1462 // TODO(irungentoo): record packet ids to check if other received complete file.
1462 ft->transferred += length; 1463 ft->transferred += length;
1463 1464
1464 if (ft->slots_allocated) { 1465 if (ft->slots_allocated) {
@@ -1541,7 +1542,7 @@ static void do_reqchunk_filecb(Messenger *m, int32_t friendnumber, void *userdat
1541 } 1542 }
1542 } 1543 }
1543 1544
1544 /* TODO: if file is too slow, switch to the next. */ 1545 /* TODO(irungentoo): if file is too slow, switch to the next. */
1545 if (ft->slots_allocated > (unsigned int)free_slots) { 1546 if (ft->slots_allocated > (unsigned int)free_slots) {
1546 free_slots = 0; 1547 free_slots = 0;
1547 } else { 1548 } else {
@@ -1600,7 +1601,7 @@ static void break_files(const Messenger *m, int32_t friendnumber)
1600{ 1601{
1601 uint32_t i; 1602 uint32_t i;
1602 1603
1603 //TODO: Inform the client which file transfers get killed with a callback? 1604 // TODO(irungentoo): Inform the client which file transfers get killed with a callback?
1604 for (i = 0; i < MAX_CONCURRENT_FILE_PIPES; ++i) { 1605 for (i = 0; i < MAX_CONCURRENT_FILE_PIPES; ++i) {
1605 if (m->friendlist[friendnumber].file_sending[i].status != FILESTATUS_NONE) { 1606 if (m->friendlist[friendnumber].file_sending[i].status != FILESTATUS_NONE) {
1606 m->friendlist[friendnumber].file_sending[i].status = FILESTATUS_NONE; 1607 m->friendlist[friendnumber].file_sending[i].status = FILESTATUS_NONE;
@@ -2438,7 +2439,7 @@ static char *ID2String(const uint8_t *pk)
2438} 2439}
2439 2440
2440/* Minimum messenger run interval in ms 2441/* Minimum messenger run interval in ms
2441 TODO: A/V */ 2442 TODO(mannol): A/V */
2442#define MIN_RUN_INTERVAL 50 2443#define MIN_RUN_INTERVAL 50
2443 2444
2444/* Return the time in milliseconds before do_messenger() should be called again 2445/* Return the time in milliseconds before do_messenger() should be called again
@@ -2710,7 +2711,7 @@ static int friends_list_load(Messenger *m, const uint8_t *data, uint32_t length)
2710 net_to_host(last_seen_time, sizeof(uint64_t)); 2711 net_to_host(last_seen_time, sizeof(uint64_t));
2711 memcpy(&m->friendlist[fnum].last_seen_time, last_seen_time, sizeof(uint64_t)); 2712 memcpy(&m->friendlist[fnum].last_seen_time, last_seen_time, sizeof(uint64_t));
2712 } else if (temp.status != 0) { 2713 } else if (temp.status != 0) {
2713 /* TODO: This is not a good way to do this. */ 2714 /* TODO(irungentoo): This is not a good way to do this. */
2714 uint8_t address[FRIEND_ADDRESS_SIZE]; 2715 uint8_t address[FRIEND_ADDRESS_SIZE];
2715 id_copy(address, temp.real_pk); 2716 id_copy(address, temp.real_pk);
2716 memcpy(address + crypto_box_PUBLICKEYBYTES, &(temp.friendrequest_nospam), sizeof(uint32_t)); 2717 memcpy(address + crypto_box_PUBLICKEYBYTES, &(temp.friendrequest_nospam), sizeof(uint32_t));
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index 59cb401e..2317eb8b 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -31,7 +31,7 @@
31#include "logger.h" 31#include "logger.h"
32 32
33#define MAX_NAME_LENGTH 128 33#define MAX_NAME_LENGTH 128
34/* TODO: this must depend on other variable. */ 34/* TODO(irungentoo): this must depend on other variable. */
35#define MAX_STATUSMESSAGE_LENGTH 1007 35#define MAX_STATUSMESSAGE_LENGTH 1007
36/* Used for TCP relays in Messenger struct (may need to be % 2 == 0)*/ 36/* Used for TCP relays in Messenger struct (may need to be % 2 == 0)*/
37#define NUM_SAVED_TCP_RELAYS 8 37#define NUM_SAVED_TCP_RELAYS 8
@@ -278,7 +278,9 @@ void getaddress(const Messenger *m, uint8_t *address);
278 278
279/* Add a friend. 279/* Add a friend.
280 * Set the data that will be sent along with friend request. 280 * Set the data that will be sent along with friend request.
281 * address is the address of the friend (returned by getaddress of the friend you wish to add) it must be FRIEND_ADDRESS_SIZE bytes. TODO: add checksum. 281 * address is the address of the friend (returned by getaddress of the friend
282 * you wish to add) it must be FRIEND_ADDRESS_SIZE bytes.
283 * TODO(irungentoo): add checksum.
282 * data is the data and length is the length. 284 * data is the data and length is the length.
283 * 285 *
284 * return the friend number if success. 286 * return the friend number if success.
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c
index 6c5ea0e1..396bb9e3 100644
--- a/toxcore/TCP_client.c
+++ b/toxcore/TCP_client.c
@@ -152,7 +152,7 @@ static int socks5_read_handshake_response(TCP_Client_Connection *TCP_conn)
152 return 0; 152 return 0;
153 } 153 }
154 154
155 if (data[0] == 5 && data[1] == 0) { // FIXME magic numbers 155 if (data[0] == 5 && data[1] == 0) { // TODO(irungentoo): magic numbers
156 return 1; 156 return 1;
157 } 157 }
158 158
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c
index bfd55fa0..25dfa09c 100644
--- a/toxcore/TCP_connection.c
+++ b/toxcore/TCP_connection.c
@@ -223,8 +223,8 @@ int send_packet_tcp_connection(TCP_Connections *tcp_c, int connections_number, c
223 return -1; 223 return -1;
224 } 224 }
225 225
226 //TODO: detect and kill bad relays. 226 // TODO(irungentoo): detect and kill bad relays.
227 //TODO: thread safety? 227 // TODO(irungentoo): thread safety?
228 unsigned int i; 228 unsigned int i;
229 int ret = -1; 229 int ret = -1;
230 230
@@ -293,8 +293,8 @@ int send_packet_tcp_connection(TCP_Connections *tcp_c, int connections_number, c
293 293
294/* Return a random TCP connection number for use in send_tcp_onion_request. 294/* Return a random TCP connection number for use in send_tcp_onion_request.
295 * 295 *
296 * TODO: This number is just the index of an array that the elements can 296 * TODO(irungentoo): This number is just the index of an array that the elements
297 * change without warning. 297 * can change without warning.
298 * 298 *
299 * return TCP connection number on success. 299 * return TCP connection number on success.
300 * return -1 on failure. 300 * return -1 on failure.
@@ -977,7 +977,7 @@ static int tcp_oob_callback(void *object, const uint8_t *public_key, const uint8
977 return -1; 977 return -1;
978 } 978 }
979 979
980 /* TODO: optimize */ 980 /* TODO(irungentoo): optimize */
981 int connections_number = find_tcp_connection_to(tcp_c, public_key); 981 int connections_number = find_tcp_connection_to(tcp_c, public_key);
982 982
983 TCP_Connection_to *con_to = get_connection(tcp_c, connections_number); 983 TCP_Connection_to *con_to = get_connection(tcp_c, connections_number);
diff --git a/toxcore/TCP_connection.h b/toxcore/TCP_connection.h
index e0a3988e..edf9ec8f 100644
--- a/toxcore/TCP_connection.h
+++ b/toxcore/TCP_connection.h
@@ -115,8 +115,8 @@ int send_packet_tcp_connection(TCP_Connections *tcp_c, int connections_number, c
115 115
116/* Return a random TCP connection number for use in send_tcp_onion_request. 116/* Return a random TCP connection number for use in send_tcp_onion_request.
117 * 117 *
118 * TODO: This number is just the index of an array that the elements can 118 * TODO(irungentoo): This number is just the index of an array that the elements
119 * change without warning. 119 * can change without warning.
120 * 120 *
121 * return TCP connection number on success. 121 * return TCP connection number on success.
122 * return -1 on failure. 122 * return -1 on failure.
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c
index 13e4da45..58efe51c 100644
--- a/toxcore/TCP_server.c
+++ b/toxcore/TCP_server.c
@@ -669,7 +669,7 @@ static int handle_TCP_routing_req(TCP_Server *TCP_server, uint32_t con_id, const
669 other_conn->connections[other_id].status = 2; 669 other_conn->connections[other_id].status = 2;
670 other_conn->connections[other_id].index = con_id; 670 other_conn->connections[other_id].index = con_id;
671 other_conn->connections[other_id].other_id = index; 671 other_conn->connections[other_id].other_id = index;
672 //TODO: return values? 672 // TODO(irungentoo): return values?
673 send_connect_notification(con, index); 673 send_connect_notification(con, index);
674 send_connect_notification(other_conn, other_id); 674 send_connect_notification(other_conn, other_id);
675 } 675 }
@@ -728,7 +728,7 @@ static int rm_connection_index(TCP_Server *TCP_server, TCP_Secure_Connection *co
728 TCP_server->accepted_connection_array[index].connections[other_id].other_id = 0; 728 TCP_server->accepted_connection_array[index].connections[other_id].other_id = 0;
729 TCP_server->accepted_connection_array[index].connections[other_id].index = 0; 729 TCP_server->accepted_connection_array[index].connections[other_id].index = 0;
730 TCP_server->accepted_connection_array[index].connections[other_id].status = 1; 730 TCP_server->accepted_connection_array[index].connections[other_id].status = 1;
731 //TODO: return values? 731 // TODO(irungentoo): return values?
732 send_disconnect_notification(&TCP_server->accepted_connection_array[index], other_id); 732 send_disconnect_notification(&TCP_server->accepted_connection_array[index], other_id);
733 } 733 }
734 734
diff --git a/toxcore/assoc.c b/toxcore/assoc.c
index df84fff5..3653a8d4 100644
--- a/toxcore/assoc.c
+++ b/toxcore/assoc.c
@@ -196,7 +196,7 @@ static void dist_index_bubble(Assoc *assoc, uint64_t *dist_list, size_t first, s
196 } 196 }
197} 197}
198 198
199/* TODO: Check that there isn't a function like this elsewhere hidden. 199/* TODO(irungentoo): Check that there isn't a function like this elsewhere hidden.
200 * E.g. the one which creates a handshake_id isn't usable for this, it must 200 * E.g. the one which creates a handshake_id isn't usable for this, it must
201 * always map the same ID to the same hash. 201 * always map the same ID to the same hash.
202 * 202 *
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c
index bcfd7e60..8f7572ab 100644
--- a/toxcore/crypto_core.c
+++ b/toxcore/crypto_core.c
@@ -157,7 +157,7 @@ int decrypt_data(const uint8_t *public_key, const uint8_t *secret_key, const uin
157/* Increment the given nonce by 1. */ 157/* Increment the given nonce by 1. */
158void increment_nonce(uint8_t *nonce) 158void increment_nonce(uint8_t *nonce)
159{ 159{
160 /* FIXME use increment_nonce_number(nonce, 1) or sodium_increment (change to little endian) 160 /* TODO(irungentoo): use increment_nonce_number(nonce, 1) or sodium_increment (change to little endian)
161 * NOTE don't use breaks inside this loop 161 * NOTE don't use breaks inside this loop
162 * In particular, make sure, as far as possible, 162 * In particular, make sure, as far as possible,
163 * that loop bounds and their potential underflow or overflow 163 * that loop bounds and their potential underflow or overflow
@@ -240,7 +240,7 @@ int create_request(const uint8_t *send_public_key, const uint8_t *send_secret_ke
240 240
241 uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2; 241 uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2;
242 new_nonce(nonce); 242 new_nonce(nonce);
243 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // FIXME sodium_memzero before exit function 243 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // TODO(irungentoo): sodium_memzero before exit function
244 memcpy(temp + 1, data, length); 244 memcpy(temp + 1, data, length);
245 temp[0] = request_id; 245 temp[0] = request_id;
246 int len = encrypt_data(recv_public_key, send_secret_key, nonce, temp, length + 1, 246 int len = encrypt_data(recv_public_key, send_secret_key, nonce, temp, length + 1,
@@ -281,7 +281,7 @@ int handle_request(const uint8_t *self_public_key, const uint8_t *self_secret_ke
281 281
282 memcpy(public_key, packet + 1 + crypto_box_PUBLICKEYBYTES, crypto_box_PUBLICKEYBYTES); 282 memcpy(public_key, packet + 1 + crypto_box_PUBLICKEYBYTES, crypto_box_PUBLICKEYBYTES);
283 const uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2; 283 const uint8_t *nonce = packet + 1 + crypto_box_PUBLICKEYBYTES * 2;
284 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // FIXME sodium_memzero before exit function 284 uint8_t temp[MAX_CRYPTO_REQUEST_SIZE]; // TODO(irungentoo): sodium_memzero before exit function
285 int len1 = decrypt_data(public_key, self_secret_key, nonce, 285 int len1 = decrypt_data(public_key, self_secret_key, nonce,
286 packet + 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES, 286 packet + 1 + crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES,
287 length - (crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + 1), temp); 287 length - (crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + 1), temp);
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h
index 5fd9bf34..4a9d06de 100644
--- a/toxcore/friend_requests.h
+++ b/toxcore/friend_requests.h
@@ -37,7 +37,7 @@ typedef struct {
37 int (*filter_function)(const uint8_t *, void *); 37 int (*filter_function)(const uint8_t *, void *);
38 void *filter_function_userdata; 38 void *filter_function_userdata;
39 /* NOTE: The following is just a temporary fix for the multiple friend requests received at the same time problem. 39 /* NOTE: The following is just a temporary fix for the multiple friend requests received at the same time problem.
40 * TODO: Make this better (This will most likely tie in with the way we will handle spam.) 40 * TODO(irungentoo): Make this better (This will most likely tie in with the way we will handle spam.)
41 */ 41 */
42 42
43#define MAX_RECEIVED_STORED 32 43#define MAX_RECEIVED_STORED 32
diff --git a/toxcore/group.c b/toxcore/group.c
index a85b7320..730378ea 100644
--- a/toxcore/group.c
+++ b/toxcore/group.c
@@ -144,7 +144,7 @@ static Group_c *get_group_c(const Group_Chats *g_c, int groupnumber)
144 * return peer index if peer is in chat. 144 * return peer index if peer is in chat.
145 * return -1 if peer is not in chat. 145 * return -1 if peer is not in chat.
146 * 146 *
147 * TODO: make this more efficient. 147 * TODO(irungentoo): make this more efficient.
148 */ 148 */
149 149
150static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk) 150static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk)
@@ -166,7 +166,7 @@ static int peer_in_chat(const Group_c *chat, const uint8_t *real_pk)
166 * return group number if peer is in list. 166 * return group number if peer is in list.
167 * return -1 if group is not in list. 167 * return -1 if group is not in list.
168 * 168 *
169 * TODO: make this more efficient and maybe use constant time comparisons? 169 * TODO(irungentoo): make this more efficient and maybe use constant time comparisons?
170 */ 170 */
171static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier) 171static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier)
172{ 172{
@@ -187,7 +187,7 @@ static int get_group_num(const Group_Chats *g_c, const uint8_t *identifier)
187 * return peer number if peer is in chat. 187 * return peer number if peer is in chat.
188 * return -1 if peer is not in chat. 188 * return -1 if peer is not in chat.
189 * 189 *
190 * TODO: make this more efficient. 190 * TODO(irungentoo): make this more efficient.
191 */ 191 */
192static int get_peer_index(Group_c *g, uint16_t peer_number) 192static int get_peer_index(Group_c *g, uint16_t peer_number)
193{ 193{
@@ -414,7 +414,7 @@ static int addpeer(Group_Chats *g_c, int groupnumber, const uint8_t *real_pk, co
414 return -1; 414 return -1;
415 } 415 }
416 416
417 //TODO 417 // TODO(irungentoo):
418 int peer_index = peer_in_chat(g, real_pk); 418 int peer_index = peer_in_chat(g, real_pk);
419 419
420 if (peer_index != -1) { 420 if (peer_index != -1) {
@@ -656,7 +656,7 @@ static int handle_status(void *object, int friendcon_id, uint8_t status, void *u
656 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_ONLINE); 656 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_ONLINE);
657 } else { /* Went offline */ 657 } else { /* Went offline */
658 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_CONNECTION); 658 set_conns_status_groups(g_c, friendcon_id, GROUPCHAT_CLOSE_CONNECTION);
659 //TODO remove timedout connections? 659 // TODO(irungentoo): remove timedout connections?
660 } 660 }
661 661
662 return 0; 662 return 0;
@@ -703,7 +703,7 @@ static int add_conn_to_groupchat(Group_Chats *g_c, int friendcon_id, int groupnu
703 g->close[ind].type = GROUPCHAT_CLOSE_CONNECTION; 703 g->close[ind].type = GROUPCHAT_CLOSE_CONNECTION;
704 g->close[ind].number = friendcon_id; 704 g->close[ind].number = friendcon_id;
705 g->close[ind].closest = closest; 705 g->close[ind].closest = closest;
706 //TODO 706 // TODO(irungentoo):
707 friend_connection_callbacks(g_c->m->fr_c, friendcon_id, GROUPCHAT_CALLBACK_INDEX, &handle_status, &handle_packet, 707 friend_connection_callbacks(g_c->m->fr_c, friendcon_id, GROUPCHAT_CALLBACK_INDEX, &handle_status, &handle_packet,
708 &handle_lossy, g_c, friendcon_id); 708 &handle_lossy, g_c, friendcon_id);
709 709
@@ -1374,8 +1374,9 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con
1374 return; 1374 return;
1375 } 1375 }
1376 1376
1377 uint16_t peer_number = rand(); /* TODO: what if two people enter the group at the same time and 1377 /* TODO(irungentoo): what if two people enter the group at the same time and
1378 are given the same peer_number by different nodes? */ 1378 are given the same peer_number by different nodes? */
1379 uint16_t peer_number = rand();
1379 1380
1380 unsigned int tries = 0; 1381 unsigned int tries = 0;
1381 1382
@@ -1903,7 +1904,7 @@ int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *ac
1903 */ 1904 */
1904int send_group_lossy_packet(const Group_Chats *g_c, int groupnumber, const uint8_t *data, uint16_t length) 1905int send_group_lossy_packet(const Group_Chats *g_c, int groupnumber, const uint8_t *data, uint16_t length)
1905{ 1906{
1906 //TODO: length check here? 1907 // TODO(irungentoo): length check here?
1907 Group_c *g = get_group_c(g_c, groupnumber); 1908 Group_c *g = get_group_c(g_c, groupnumber);
1908 1909
1909 if (!g) { 1910 if (!g) {
@@ -2004,7 +2005,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2004 delpeer(g_c, groupnumber, index); 2005 delpeer(g_c, groupnumber, index);
2005 } else { 2006 } else {
2006 return; 2007 return;
2007 //TODO 2008 // TODO(irungentoo):
2008 } 2009 }
2009 } 2010 }
2010 break; 2011 break;
@@ -2032,7 +2033,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2032 memcpy(newmsg, msg_data, msg_data_len); 2033 memcpy(newmsg, msg_data, msg_data_len);
2033 newmsg[msg_data_len] = 0; 2034 newmsg[msg_data_len] = 0;
2034 2035
2035 //TODO 2036 // TODO(irungentoo):
2036 if (g_c->message_callback) { 2037 if (g_c->message_callback) {
2037 g_c->message_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->message_callback_userdata); 2038 g_c->message_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->message_callback_userdata);
2038 } 2039 }
@@ -2049,7 +2050,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2049 memcpy(newmsg, msg_data, msg_data_len); 2050 memcpy(newmsg, msg_data, msg_data_len);
2050 newmsg[msg_data_len] = 0; 2051 newmsg[msg_data_len] = 0;
2051 2052
2052 //TODO 2053 // TODO(irungentoo):
2053 if (g_c->action_callback) { 2054 if (g_c->action_callback) {
2054 g_c->action_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->action_callback_userdata); 2055 g_c->action_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->action_callback_userdata);
2055 } 2056 }
@@ -2061,7 +2062,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2061 return; 2062 return;
2062 } 2063 }
2063 2064
2064 send_message_all_close(g_c, groupnumber, data, length, -1/*TODO close_index*/); 2065 send_message_all_close(g_c, groupnumber, data, length, -1/* TODO(irungentoo) close_index */);
2065} 2066}
2066 2067
2067static int handle_packet(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata) 2068static int handle_packet(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata)
@@ -2120,7 +2121,7 @@ static int handle_packet(void *object, int friendcon_id, const uint8_t *data, ui
2120 * return 0 if packet was not received. 2121 * return 0 if packet was not received.
2121 * return 1 if packet was received. 2122 * return 1 if packet was received.
2122 * 2123 *
2123 * TODO: test this 2124 * TODO(irungentoo): test this
2124 */ 2125 */
2125static unsigned int lossy_packet_not_received(Group_c *g, int peer_index, uint16_t message_number) 2126static unsigned int lossy_packet_not_received(Group_c *g, int peer_index, uint16_t message_number)
2126{ 2127{
@@ -2416,7 +2417,7 @@ void do_groupchats(Group_Chats *g_c, void *userdata)
2416 } 2417 }
2417 } 2418 }
2418 2419
2419 //TODO 2420 // TODO(irungentoo):
2420} 2421}
2421 2422
2422/* Free everything related with group chats. */ 2423/* Free everything related with group chats. */
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index a354c36b..2da8de61 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -505,7 +505,7 @@ static IP_Port return_ip_port_connection(Net_Crypto *c, int crypt_connection_id)
505 */ 505 */
506static int send_packet_to(Net_Crypto *c, int crypt_connection_id, const uint8_t *data, uint16_t length) 506static int send_packet_to(Net_Crypto *c, int crypt_connection_id, const uint8_t *data, uint16_t length)
507{ 507{
508//TODO TCP, etc... 508// TODO(irungentoo): TCP, etc...
509 Crypto_Connection *conn = get_crypto_connection(c, crypt_connection_id); 509 Crypto_Connection *conn = get_crypto_connection(c, crypt_connection_id);
510 510
511 if (conn == 0) { 511 if (conn == 0) {
@@ -517,7 +517,7 @@ static int send_packet_to(Net_Crypto *c, int crypt_connection_id, const uint8_t
517 pthread_mutex_lock(&conn->mutex); 517 pthread_mutex_lock(&conn->mutex);
518 IP_Port ip_port = return_ip_port_connection(c, crypt_connection_id); 518 IP_Port ip_port = return_ip_port_connection(c, crypt_connection_id);
519 519
520 //TODO: on bad networks, direct connections might not last indefinitely. 520 // TODO(irungentoo): on bad networks, direct connections might not last indefinitely.
521 if (ip_port.ip.family != 0) { 521 if (ip_port.ip.family != 0) {
522 bool direct_connected = 0; 522 bool direct_connected = 0;
523 crypto_connection_status(c, crypt_connection_id, &direct_connected, NULL); 523 crypto_connection_status(c, crypt_connection_id, &direct_connected, NULL);
@@ -532,7 +532,7 @@ static int send_packet_to(Net_Crypto *c, int crypt_connection_id, const uint8_t
532 return -1; 532 return -1;
533 } 533 }
534 534
535 //TODO: a better way of sending packets directly to confirm the others ip. 535 // TODO(irungentoo): a better way of sending packets directly to confirm the others ip.
536 uint64_t current_time = unix_time(); 536 uint64_t current_time = unix_time();
537 537
538 if ((((UDP_DIRECT_TIMEOUT / 2) + conn->direct_send_attempt_time) > current_time && length < 96) 538 if ((((UDP_DIRECT_TIMEOUT / 2) + conn->direct_send_attempt_time) > current_time && length < 96)
@@ -1403,7 +1403,7 @@ static int handle_data_packet_helper(Net_Crypto *c, int crypt_connection_id, con
1403 return -1; 1403 return -1;
1404 } 1404 }
1405 1405
1406 // else { /* TODO? */ } 1406 // else { /* TODO(irungentoo): ? */ }
1407 1407
1408 set_buffer_end(&conn->recv_array, num); 1408 set_buffer_end(&conn->recv_array, num);
1409 } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { 1409 } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) {
@@ -1595,7 +1595,7 @@ static int create_crypto_connection(Net_Crypto *c)
1595 } 1595 }
1596 } 1596 }
1597 1597
1598 while (1) { /* TODO: is this really the best way to do this? */ 1598 while (1) { /* TODO(irungentoo): is this really the best way to do this? */
1599 pthread_mutex_lock(&c->connections_mutex); 1599 pthread_mutex_lock(&c->connections_mutex);
1600 1600
1601 if (!c->connection_use_counter) { 1601 if (!c->connection_use_counter) {
@@ -1967,7 +1967,7 @@ static int tcp_data_callback(void *object, int id, const uint8_t *data, uint16_t
1967 return -1; 1967 return -1;
1968 } 1968 }
1969 1969
1970 //TODO detect and kill bad TCP connections. 1970 // TODO(irungentoo): detect and kill bad TCP connections.
1971 return 0; 1971 return 0;
1972} 1972}
1973 1973
@@ -2034,7 +2034,7 @@ int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key)
2034 2034
2035/* Return a random TCP connection number for use in send_tcp_onion_request. 2035/* Return a random TCP connection number for use in send_tcp_onion_request.
2036 * 2036 *
2037 * TODO: This number is just the index of an array that the elements can 2037 * TODO(irungentoo): This number is just the index of an array that the elements can
2038 * change without warning. 2038 * change without warning.
2039 * 2039 *
2040 * return TCP connection number on success. 2040 * return TCP connection number on success.
@@ -2388,7 +2388,7 @@ static void send_crypto_packets(Net_Crypto *c)
2388 } else { 2388 } else {
2389 long signed int total_sent = 0, total_resent = 0; 2389 long signed int total_sent = 0, total_resent = 0;
2390 2390
2391 //TODO use real delay 2391 // TODO(irungentoo): use real delay
2392 unsigned int delay = (unsigned int)((conn->rtt_time / PACKET_COUNTER_AVERAGE_INTERVAL) + 0.5); 2392 unsigned int delay = (unsigned int)((conn->rtt_time / PACKET_COUNTER_AVERAGE_INTERVAL) + 0.5);
2393 unsigned int packets_set_rem_array = (CONGESTION_LAST_SENT_ARRAY_SIZE - CONGESTION_QUEUE_ARRAY_SIZE); 2393 unsigned int packets_set_rem_array = (CONGESTION_LAST_SENT_ARRAY_SIZE - CONGESTION_QUEUE_ARRAY_SIZE);
2394 2394
@@ -2424,7 +2424,7 @@ static void send_crypto_packets(Net_Crypto *c)
2424 2424
2425 double send_array_ratio = (((double)npackets) / min_speed); 2425 double send_array_ratio = (((double)npackets) / min_speed);
2426 2426
2427 //TODO: Improve formula? 2427 // TODO(irungentoo): Improve formula?
2428 if (send_array_ratio > SEND_QUEUE_RATIO && CRYPTO_MIN_QUEUE_LENGTH < npackets) { 2428 if (send_array_ratio > SEND_QUEUE_RATIO && CRYPTO_MIN_QUEUE_LENGTH < npackets) {
2429 conn->packet_send_rate = min_speed * (1.0 / (send_array_ratio / SEND_QUEUE_RATIO)); 2429 conn->packet_send_rate = min_speed * (1.0 / (send_array_ratio / SEND_QUEUE_RATIO));
2430 } else if (conn->last_congestion_event + CONGESTION_EVENT_TIMEOUT < temp_time) { 2430 } else if (conn->last_congestion_event + CONGESTION_EVENT_TIMEOUT < temp_time) {
@@ -2680,7 +2680,7 @@ int send_lossy_cryptpacket(Net_Crypto *c, int crypt_connection_id, const uint8_t
2680 */ 2680 */
2681int crypto_kill(Net_Crypto *c, int crypt_connection_id) 2681int crypto_kill(Net_Crypto *c, int crypt_connection_id)
2682{ 2682{
2683 while (1) { /* TODO: is this really the best way to do this? */ 2683 while (1) { /* TODO(irungentoo): is this really the best way to do this? */
2684 pthread_mutex_lock(&c->connections_mutex); 2684 pthread_mutex_lock(&c->connections_mutex);
2685 2685
2686 if (!c->connection_use_counter) { 2686 if (!c->connection_use_counter) {
@@ -2759,7 +2759,7 @@ void new_keys(Net_Crypto *c)
2759/* Save the public and private keys to the keys array. 2759/* Save the public and private keys to the keys array.
2760 * Length must be crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES. 2760 * Length must be crypto_box_PUBLICKEYBYTES + crypto_box_SECRETKEYBYTES.
2761 * 2761 *
2762 * TODO: Save only secret key. 2762 * TODO(irungentoo): Save only secret key.
2763 */ 2763 */
2764void save_keys(const Net_Crypto *c, uint8_t *keys) 2764void save_keys(const Net_Crypto *c, uint8_t *keys)
2765{ 2765{
@@ -2857,7 +2857,7 @@ static void kill_timedout(Net_Crypto *c, void *userdata)
2857#if 0 2857#if 0
2858 2858
2859 if (conn->status == CRYPTO_CONN_ESTABLISHED) { 2859 if (conn->status == CRYPTO_CONN_ESTABLISHED) {
2860 //TODO: add a timeout here? 2860 // TODO(irungentoo): add a timeout here?
2861 } 2861 }
2862 2862
2863#endif 2863#endif
diff --git a/toxcore/network.c b/toxcore/network.c
index e42c962b..b472ed31 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -494,14 +494,15 @@ int networking_at_startup(void)
494 return 0; 494 return 0;
495} 495}
496 496
497/* TODO: Put this somewhere 497/* TODO(irungentoo): Put this somewhere */
498#if 0
498static void at_shutdown(void) 499static void at_shutdown(void)
499{ 500{
500#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) 501#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
501 WSACleanup(); 502 WSACleanup();
502#endif 503#endif
503} 504}
504*/ 505#endif
505 506
506/* Initialize networking. 507/* Initialize networking.
507 * Added for reverse compatibility with old new_networking calls. 508 * Added for reverse compatibility with old new_networking calls.
@@ -873,7 +874,7 @@ void ipport_copy(IP_Port *target, const IP_Port *source)
873 * writes error message into the buffer on error 874 * writes error message into the buffer on error
874 */ 875 */
875/* there would be INET6_ADDRSTRLEN, but it might be too short for the error message */ 876/* there would be INET6_ADDRSTRLEN, but it might be too short for the error message */
876static char addresstext[96]; // FIXME magic number. Why not INET6_ADDRSTRLEN ? 877static char addresstext[96]; // TODO(irungentoo): magic number. Why not INET6_ADDRSTRLEN ?
877const char *ip_ntoa(const IP *ip) 878const char *ip_ntoa(const IP *ip)
878{ 879{
879 if (ip) { 880 if (ip) {
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 04822cc1..316ed3d1 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -203,7 +203,7 @@ static int is_path_used(const Onion_Client_Paths *onion_paths, const Node_format
203 continue; 203 continue;
204 } 204 }
205 205
206 // TODO: do we really have to check it with the last node? 206 // TODO(irungentoo): do we really have to check it with the last node?
207 if (ipport_equal(&onion_paths->paths[i].ip_port1, &nodes[ONION_PATH_LENGTH - 1].ip_port)) { 207 if (ipport_equal(&onion_paths->paths[i].ip_port1, &nodes[ONION_PATH_LENGTH - 1].ip_port)) {
208 return i; 208 return i;
209 } 209 }
@@ -228,8 +228,8 @@ static bool path_timed_out(Onion_Client_Paths *onion_paths, uint32_t pathnum)
228 * return -1 on failure 228 * return -1 on failure
229 * return 0 on success 229 * return 0 on success
230 * 230 *
231 * TODO: Make this function better, it currently probably is vulnerable to some attacks that 231 * TODO(irungentoo): Make this function better, it currently probably is
232 * could de anonimize us. 232 * vulnerable to some attacks that could deanonimize us.
233 */ 233 */
234static int random_path(const Onion_Client *onion_c, Onion_Client_Paths *onion_paths, uint32_t pathnum, Onion_Path *path) 234static int random_path(const Onion_Client *onion_c, Onion_Client_Paths *onion_paths, uint32_t pathnum, Onion_Path *path)
235{ 235{
@@ -558,7 +558,7 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, const uint8_t
558 memcpy(list_nodes[index].public_key, public_key, crypto_box_PUBLICKEYBYTES); 558 memcpy(list_nodes[index].public_key, public_key, crypto_box_PUBLICKEYBYTES);
559 list_nodes[index].ip_port = ip_port; 559 list_nodes[index].ip_port = ip_port;
560 560
561 //TODO: remove this and find a better source of nodes to use for paths. 561 // TODO(irungentoo): remove this and find a better source of nodes to use for paths.
562 onion_add_path_node(onion_c, ip_port, public_key); 562 onion_add_path_node(onion_c, ip_port, public_key);
563 563
564 if (is_stored == 1) { 564 if (is_stored == 1) {
@@ -718,7 +718,7 @@ static int handle_announce_response(void *object, IP_Port source, const uint8_t
718 } 718 }
719 } 719 }
720 720
721 //TODO: LAN vs non LAN ips?, if we are connected only to LAN, are we offline? 721 // TODO(irungentoo): LAN vs non LAN ips?, if we are connected only to LAN, are we offline?
722 onion_c->last_packet_recv = unix_time(); 722 onion_c->last_packet_recv = unix_time();
723 return 0; 723 return 0;
724} 724}
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 463238b5..b9bab973 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -250,7 +250,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error)
250 250
251 if (!addr_resolve_or_parse_ip(options->proxy_host, &m_options.proxy_info.ip_port.ip, NULL)) { 251 if (!addr_resolve_or_parse_ip(options->proxy_host, &m_options.proxy_info.ip_port.ip, NULL)) {
252 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST); 252 SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST);
253 //TODO: TOX_ERR_NEW_PROXY_NOT_FOUND if domain. 253 // TODO(irungentoo): TOX_ERR_NEW_PROXY_NOT_FOUND if domain.
254 return NULL; 254 return NULL;
255 } 255 }
256 256
@@ -527,7 +527,7 @@ bool tox_self_set_name(Tox *tox, const uint8_t *name, size_t length, TOX_ERR_SET
527 Messenger *m = tox; 527 Messenger *m = tox;
528 528
529 if (setname(m, name, length) == 0) { 529 if (setname(m, name, length) == 0) {
530 //TODO: function to set different per group names? 530 // TODO(irungentoo): function to set different per group names?
531 send_name_all_groups(m->group_chat_object); 531 send_name_all_groups(m->group_chat_object);
532 SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK); 532 SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK);
533 return 1; 533 return 1;
@@ -672,7 +672,7 @@ bool tox_friend_delete(Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_DELETE *
672 Messenger *m = tox; 672 Messenger *m = tox;
673 int ret = m_delfriend(m, friend_number); 673 int ret = m_delfriend(m, friend_number);
674 674
675 //TODO handle if realloc fails? 675 // TODO(irungentoo): handle if realloc fails?
676 if (ret == -1) { 676 if (ret == -1) {
677 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_DELETE_FRIEND_NOT_FOUND); 677 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_DELETE_FRIEND_NOT_FOUND);
678 return 0; 678 return 0;
@@ -749,7 +749,7 @@ void tox_self_get_friend_list(const Tox *tox, uint32_t *friend_list)
749{ 749{
750 if (friend_list) { 750 if (friend_list) {
751 const Messenger *m = tox; 751 const Messenger *m = tox;
752 //TODO: size parameter? 752 // TODO(irungentoo): size parameter?
753 copy_friendlist(m, friend_list, tox_self_get_friend_list_size(tox)); 753 copy_friendlist(m, friend_list, tox_self_get_friend_list_size(tox));
754 } 754 }
755} 755}
@@ -816,7 +816,7 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8
816 } 816 }
817 817
818 const Messenger *m = tox; 818 const Messenger *m = tox;
819 //TODO: size parameter? 819 // TODO(irungentoo): size parameter?
820 int ret = m_copy_statusmessage(m, friend_number, status_message, m_get_statusmessage_size(m, friend_number)); 820 int ret = m_copy_statusmessage(m, friend_number, status_message, m_get_statusmessage_size(m, friend_number));
821 821
822 if (ret == -1) { 822 if (ret == -1) {
diff --git a/toxcore/tox.h b/toxcore/tox.h
index 60110ea8..a8488aeb 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -282,7 +282,7 @@ uint32_t tox_max_friend_request_length(void);
282uint32_t tox_max_message_length(void); 282uint32_t tox_max_message_length(void);
283 283
284/** 284/**
285 * Maximum size of custom packets. TODO: should be LENGTH? 285 * Maximum size of custom packets. TODO(iphydf): should be LENGTH?
286 */ 286 */
287#define TOX_MAX_CUSTOM_PACKET_SIZE 1373 287#define TOX_MAX_CUSTOM_PACKET_SIZE 1373
288 288
@@ -928,7 +928,7 @@ typedef void tox_self_connection_status_cb(Tox *tox, TOX_CONNECTION connection_s
928 * amounts of time. Clients should therefore not immediately bootstrap on 928 * amounts of time. Clients should therefore not immediately bootstrap on
929 * receiving a disconnect. 929 * receiving a disconnect.
930 * 930 *
931 * TODO: how long should a client wait before bootstrapping again? 931 * TODO(iphydf): how long should a client wait before bootstrapping again?
932 */ 932 */
933void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *callback); 933void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *callback);
934 934