From 2bb2bc4163a13253d51b7d11e4abbe62b07da526 Mon Sep 17 00:00:00 2001 From: cgar Date: Tue, 9 Sep 2014 20:31:37 -0400 Subject: [PATCH 1/5] spelling corrections --- docs/Prevent_Tracking.txt | 3 ++- docs/Tox_middle_level_network_protocol.txt | 16 ++++++++-------- other/bootstrap_daemon/tox-bootstrapd.c | 2 +- toxav/msi.c | 4 ++-- toxav/toxav.c | 6 +++--- toxav/toxav.h | 4 ++-- toxcore/Messenger.c | 2 +- toxcore/crypto_core.c | 2 +- toxcore/crypto_core.h | 2 +- toxcore/net_crypto.c | 12 ++++++------ toxcore/net_crypto.h | 4 ++-- toxdns/toxdns.c | 2 +- toxdns/toxdns.h | 2 +- 13 files changed, 31 insertions(+), 30 deletions(-) diff --git a/docs/Prevent_Tracking.txt b/docs/Prevent_Tracking.txt index 86402110..a641f02c 100644 --- a/docs/Prevent_Tracking.txt +++ b/docs/Prevent_Tracking.txt @@ -119,7 +119,8 @@ announce response packet: encrypted with the DHT private key of Node D, the public key in the request and the nonce:[[uint8_t is_stored] [(32 bytes) ping_id if is_stored is 0 or 2, public key that must be used to send data packets if is_stored is 1][Node_Format * (maximum of 8)]] (if the is_stored is not 0, it means the information to reach the client id we are searching for is stored on this node) -is_stored is 2 as a response to a peer trying to announce himself to tell the peer that he is currently annouced successfully. +is_stored is 2 as a response to a peer trying to announce himself to tell the +peer that he is currently announced successfully. data to route response packet: [uint8_t packet id (134)][nonce][temporary just generated public key] diff --git a/docs/Tox_middle_level_network_protocol.txt b/docs/Tox_middle_level_network_protocol.txt index ff894246..ca561474 100644 --- a/docs/Tox_middle_level_network_protocol.txt +++ b/docs/Tox_middle_level_network_protocol.txt @@ -43,13 +43,13 @@ cookie request packet: bytes)][Encrypted message containing: [Senders real public key (32 bytes)][padding (32 bytes)][uint64_t number (must be sent back untouched in cookie response)]] -Encrypted message is encrypted with sender DHT private key, recievers DHT +Encrypted message is encrypted with sender DHT private key, receivers DHT public key and the nonce. cookie response packet: [uint8_t 25][Random nonce (24 bytes)][Encrypted message containing: [Cookie][uint64_t number (that was sent in the request)]] -Encrypted message is encrypted with sender DHT private key, recievers DHT +Encrypted message is encrypted with sender DHT private key, receivers DHT public key and the nonce. The Cookie should be basically: @@ -110,11 +110,11 @@ packet request packet: [uint8_t (1)][uint8_t num][uint8_t num][uint8_t num]...[uint8_t num] the list of nums are a list of packet numbers the other is requesting. -to get the real packet numbers from this list take the recvbuffers buffer_start -from the packet, substract 1 to it and put it in packet_num then start from the -beggining of the num list: if num is zero, add 255 to packet_num then do the -next num. if num isn't zero, add its value to packet_num, note that the other -has requested we send this packet again to them then continue to the next num in -the list. +to get the real packet numbers from this list take the recvbuffers buffer_start +from the packet, subtract 1 to it and put it in packet_num then start from the +beginning of the num list: if num is zero, add 255 to packet_num then do the +next num. if num isn't zero, add its value to packet_num, note that the other +has requested we send this packet again to them then continue to the next num in +the list. diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index a5d1c525..e4cadb35 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c @@ -187,7 +187,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int config_setting_t *elem = config_setting_get_elem(ports_array, i); if (elem == NULL) { - // it's NULL if `ports_array` is not an array (we have that check ealier) or if `i` is out of range, which should not be + // it's NULL if `ports_array` is not an array (we have that check earlier) or if `i` is out of range, which should not be syslog(LOG_WARNING, "Port #%d: Something went wrong while parsing the port. Stopping reading ports.\n", i); break; } diff --git a/toxav/msi.c b/toxav/msi.c index 91742c35..dad32afe 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -618,7 +618,7 @@ static void *timer_poll( void *arg ) LOGGER_ERROR("Failed to execute timer at: %d!", handler->timers[0]->timeout); free(args); } else { - LOGGER_DEBUG("Exectued timer assigned at: %d", handler->timers[0]->timeout); + LOGGER_DEBUG("Executed timer assigned at: %d", handler->timers[0]->timeout); } timer_release(handler, handler->timers[0]->idx, 0); @@ -1436,7 +1436,7 @@ static void msi_handle_packet ( Messenger *messenger, int source, const uint8_t MSIMessage *msg; if ( !length ) { - LOGGER_WARNING("Lenght param negative"); + LOGGER_WARNING("Length param negative"); return; } diff --git a/toxav/toxav.c b/toxav/toxav.c index cd0ec70e..7cba031e 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c @@ -230,7 +230,7 @@ void toxav_register_callstate_callback ( ToxAv *av, ToxAVCallback callback, ToxA } /** - * @brief Register callback for recieving audio data + * @brief Register callback for receiving audio data * * @param callback The callback * @return void @@ -243,7 +243,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, in } /** - * @brief Register callback for recieving video data + * @brief Register callback for receiving video data * * @param callback The callback * @return void @@ -1091,7 +1091,7 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg) if (i == 0) { /* piece of current frame */ } else if (i > 0 && i < 128) { - /* recieved a piece of a frame ahead, flush current frame and start reading this new frame */ + /* received a piece of a frame ahead, flush current frame and start reading this new frame */ DECODE_PACKET *p = malloc(sizeof(DECODE_PACKET) + call->frame_limit); if (p) { diff --git a/toxav/toxav.h b/toxav/toxav.h index e31c7aad..34c8be5d 100644 --- a/toxav/toxav.h +++ b/toxav/toxav.h @@ -167,7 +167,7 @@ void toxav_kill(ToxAv *av); void toxav_register_callstate_callback (ToxAv *av, ToxAVCallback callback, ToxAvCallbackID id, void *userdata); /** - * @brief Register callback for recieving audio data + * @brief Register callback for receiving audio data * * @param av Handler. * @param callback The callback @@ -177,7 +177,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, in void *user_data); /** - * @brief Register callback for recieving video data + * @brief Register callback for receiving video data * * @param av Handler. * @param callback The callback diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 7ea89ea6..930ad67c 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -1949,7 +1949,7 @@ static void check_friend_request_timed_out(Messenger *m, uint32_t i, uint64_t t) if (f->friendrequest_lastsent + f->friendrequest_timeout < t) { set_friend_status(m, i, FRIEND_ADDED); - /* Double the default timeout everytime if friendrequest is assumed + /* Double the default timeout every time if friendrequest is assumed * to have been sent unsuccessfully. */ f->friendrequest_timeout *= 2; diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index 1799b600..32d07208 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c @@ -210,7 +210,7 @@ void new_nonce(uint8_t *nonce) /* Create a request to peer. * send_public_key and send_secret_key are the pub/secret keys of the sender. - * recv_public_key is public key of reciever. + * recv_public_key is public key of receiver. * packet must be an array of MAX_CRYPTO_REQUEST_SIZE big. * Data represents the data we send with the request with length being the length of the data. * request_id is the id of the request (32 = friend request, 254 = ping request). diff --git a/toxcore/crypto_core.h b/toxcore/crypto_core.h index 7362d49e..f19a9790 100644 --- a/toxcore/crypto_core.h +++ b/toxcore/crypto_core.h @@ -129,7 +129,7 @@ void new_nonce(uint8_t *nonce); /* Create a request to peer. * send_public_key and send_secret_key are the pub/secret keys of the sender. - * recv_public_key is public key of reciever. + * recv_public_key is public key of receiver. * packet must be an array of MAX_CRYPTO_REQUEST_SIZE big. * Data represents the data we send with the request with length being the length of the data. * request_id is the id of the request (32 = friend request, 254 = ping request). diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 13b6625c..172e439b 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -657,7 +657,7 @@ static int generate_request_packet(uint8_t *data, uint16_t length, const Packets } /* Handle a request data packet. - * Remove all the packets the other recieved from the array. + * Remove all the packets the other received from the array. * * return -1 on failure. * return number of requested packets on success. @@ -1084,7 +1084,7 @@ static int send_kill_packet(Net_Crypto *c, int crypt_connection_id) &kill_packet, sizeof(kill_packet)); } -/* Handle a recieved data packet. +/* Handle a received data packet. * * return -1 on failure. * return 0 on success. @@ -1181,7 +1181,7 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i return 0; } -/* Handle a packet that was recieved for the connection. +/* Handle a packet that was received for the connection. * * return -1 on failure. * return 0 on success. @@ -1387,7 +1387,7 @@ static int getcryptconnection_id_dht_pubkey(const Net_Crypto *c, const uint8_t * } /* Add a source to the crypto connection. - * This is to be used only when we have recieved a packet from that source. + * This is to be used only when we have received a packet from that source. * * return -1 on failure. * return positive number on success. @@ -1990,7 +1990,7 @@ int send_tcp_onion_request(Net_Crypto *c, const uint8_t *data, uint16_t length) return -1; } -/* Set the function to be called when an onion response packet is recieved by one of the TCP connections. +/* Set the function to be called when an onion response packet is received by one of the TCP connections. */ void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data, uint16_t length), void *object) @@ -2290,7 +2290,7 @@ static int udp_handle_packet(void *object, IP_Port source, const uint8_t *packet return 0; } -/* The dT for the average packet recieving rate calculations. +/* The dT for the average packet receiving rate calculations. Also used as the */ #define PACKET_COUNTER_AVERAGE_INTERVAL 100 diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index 054bcbb1..f43e74c2 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h @@ -56,7 +56,7 @@ before giving up. */ #define MAX_NUM_SENDPACKET_TRIES 8 -/* The timeout of no recieved UDP packets before the direct UDP connection is considered dead. */ +/* The timeout of no received UDP packets before the direct UDP connection is considered dead. */ #define UDP_DIRECT_TIMEOUT (MAX_NUM_SENDPACKET_TRIES * CRYPTO_SEND_PACKET_INTERVAL * 2) #define PACKET_ID_PADDING 0 @@ -341,7 +341,7 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port, */ int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key); -/* Set the function to be called when an onion response packet is recieved by one of the TCP connections. +/* Set the function to be called when an onion response packet is received by one of the TCP connections. */ void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data, uint16_t length), void *object); diff --git a/toxdns/toxdns.c b/toxdns/toxdns.c index 7a7a052d..186ea82b 100644 --- a/toxdns/toxdns.c +++ b/toxdns/toxdns.c @@ -95,7 +95,7 @@ void tox_dns3_kill(void *dns3_object) * This is what the string returned looks like: * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc * - * returns length of string on sucess. + * returns length of string on success. * returns -1 on failure. */ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id, diff --git a/toxdns/toxdns.h b/toxdns/toxdns.h index a0cc323b..bbcbea80 100644 --- a/toxdns/toxdns.h +++ b/toxdns/toxdns.h @@ -61,7 +61,7 @@ void tox_dns3_kill(void *dns3_object); * This is what the string returned looks like: * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc * - * returns length of string on sucess. + * returns length of string on success. * returns -1 on failure. */ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id, From 766fce3e477f59c2167153416bdb97a0a2103687 Mon Sep 17 00:00:00 2001 From: urras Date: Wed, 10 Sep 2014 12:50:38 -0400 Subject: [PATCH 2/5] Grammar fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82f5beae..fab45653 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Every peer is represented as a [byte string][String] (the public key [Tox ID] of We want Tox to be as simple as possible while remaining as secure as possible. ### Why are you doing this? There are already a bunch of free Skype alternatives. -The goal of this project is to create a configuration-free P2P Skype replacement. Configuration-free means that the user will simply have to open the program and without any account configuration will be capable of adding people to his or her's friends list and start conversing with them. There are many so-called Skype replacements and all of them are either hard to configure for the normal user or suffer from being way too centralized. +The goal of this project is to create a configuration-free P2P Skype replacement. “Configuration-free” means that the user will simply have to open the program and will be capable of adding people and communicating with them without having to set up an account. There are many so-called Skype replacements, but all of them are either hard to configure for the normal user or suffer from being way too centralized. ## TODO: - [TODO](/docs/TODO) From 35da73beff0ea860a580264e96e724e50c715462 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Wed, 10 Sep 2014 19:15:59 +0200 Subject: [PATCH 3/5] Fix exceptional leak in msi.c --- toxav/msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toxav/msi.c b/toxav/msi.c index dad32afe..19925f9d 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -1552,6 +1552,7 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls ) if (retu == NULL) { LOGGER_ERROR("Allocation failed! Program might misbehave!"); + timer_terminate_session(handler); return NULL; } @@ -1561,6 +1562,7 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls ) if (!(retu->calls = calloc( sizeof (MSICall *), max_calls ))) { LOGGER_ERROR("Allocation failed! Program might misbehave!"); + timer_terminate_session(handler); free(retu); return NULL; } From 6c2ea907e91019a219ca60b2639182d262ea98a4 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Wed, 10 Sep 2014 19:36:51 +0200 Subject: [PATCH 4/5] Remove unused variable in handle_sendnodes --- toxcore/group_chats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c index 77fa6acd..949ec53a 100644 --- a/toxcore/group_chats.c +++ b/toxcore/group_chats.c @@ -469,7 +469,7 @@ static int handle_sendnodes(Group_Chat *chat, IP_Port source, int peernum, const } } - int ok = add_closepeer(chat, chat->group[peernum].client_id, source); + add_closepeer(chat, chat->group[peernum].client_id, source); return 0; } From 5abcb7e32e3132d77237d22e36d03d1018388407 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Wed, 10 Sep 2014 19:47:14 +0200 Subject: [PATCH 5/5] Remove unused function in DHT.c --- toxcore/DHT.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 6bd23081..fb326c9b 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -65,11 +65,6 @@ /* Number of get node requests to send to quickly find close nodes. */ #define MAX_BOOTSTRAP_TIMES 10 -Client_data *DHT_get_close_list(DHT *dht) -{ - return dht->close_clientlist; -} - /* Compares client_id1 and client_id2 with client_id. * * return 0 if both are same distance.