summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-05 10:31:29 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-05 23:09:28 +0000
commit8739f7fccb7cafc54ca0f5fa074c9a740f7048ba (patch)
tree88e9f53fa6e734cd8095487d1896c56f844c782c /toxcore/friend_connection.c
parent64d0297acc7d6a1697683052e15cc76383312c38 (diff)
Make tox.c unambiguously parseable.
Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r--toxcore/friend_connection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index fd5e3078..62f76b22 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -354,7 +354,7 @@ static void change_dht_pk(Friend_Connections *fr_c, int friendcon_id, const uint
354 friend_con->dht_pk_lastrecv = unix_time(); 354 friend_con->dht_pk_lastrecv = unix_time();
355 355
356 if (friend_con->dht_lock) { 356 if (friend_con->dht_lock) {
357 if (DHT_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock) != 0) { 357 if (dht_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock) != 0) {
358 printf("a. Could not delete dht peer. Please report this.\n"); 358 printf("a. Could not delete dht peer. Please report this.\n");
359 return; 359 return;
360 } 360 }
@@ -362,7 +362,7 @@ static void change_dht_pk(Friend_Connections *fr_c, int friendcon_id, const uint
362 friend_con->dht_lock = 0; 362 friend_con->dht_lock = 0;
363 } 363 }
364 364
365 DHT_addfriend(fr_c->dht, dht_public_key, dht_ip_callback, fr_c, friendcon_id, &friend_con->dht_lock); 365 dht_addfriend(fr_c->dht, dht_public_key, dht_ip_callback, fr_c, friendcon_id, &friend_con->dht_lock);
366 memcpy(friend_con->dht_temp_pk, dht_public_key, CRYPTO_PUBLIC_KEY_SIZE); 366 memcpy(friend_con->dht_temp_pk, dht_public_key, CRYPTO_PUBLIC_KEY_SIZE);
367} 367}
368 368
@@ -789,7 +789,7 @@ int kill_friend_connection(Friend_Connections *fr_c, int friendcon_id)
789 crypto_kill(fr_c->net_crypto, friend_con->crypt_connection_id); 789 crypto_kill(fr_c->net_crypto, friend_con->crypt_connection_id);
790 790
791 if (friend_con->dht_lock) { 791 if (friend_con->dht_lock) {
792 DHT_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock); 792 dht_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock);
793 } 793 }
794 794
795 return wipe_friend_conn(fr_c, friendcon_id); 795 return wipe_friend_conn(fr_c, friendcon_id);
@@ -909,7 +909,7 @@ void do_friend_connections(Friend_Connections *fr_c, void *userdata)
909 if (friend_con->status == FRIENDCONN_STATUS_CONNECTING) { 909 if (friend_con->status == FRIENDCONN_STATUS_CONNECTING) {
910 if (friend_con->dht_pk_lastrecv + FRIEND_DHT_TIMEOUT < temp_time) { 910 if (friend_con->dht_pk_lastrecv + FRIEND_DHT_TIMEOUT < temp_time) {
911 if (friend_con->dht_lock) { 911 if (friend_con->dht_lock) {
912 DHT_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock); 912 dht_delfriend(fr_c->dht, friend_con->dht_temp_pk, friend_con->dht_lock);
913 friend_con->dht_lock = 0; 913 friend_con->dht_lock = 0;
914 memset(friend_con->dht_temp_pk, 0, CRYPTO_PUBLIC_KEY_SIZE); 914 memset(friend_con->dht_temp_pk, 0, CRYPTO_PUBLIC_KEY_SIZE);
915 } 915 }