diff options
author | irungentoo <irungentoo@gmail.com> | 2013-10-23 14:42:39 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-10-23 14:42:39 -0400 |
commit | 2e75648f5151f163908da60f4bff6b0c8387c6f8 (patch) | |
tree | dba2e553c0a9f34970d17122dd26b74b22524ece /toxcore/Messenger.c | |
parent | a67b4f8c6d85b5d77cbd8b04a1f7a90a4470947b (diff) |
Code cleanups.
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index eb379c4c..ff64a072 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1357,7 +1357,7 @@ static void LANdiscovery(Messenger *m) | |||
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | /* Run this at startup. */ | 1359 | /* Run this at startup. */ |
1360 | Messenger *initMessenger(uint8_t ipv6enabled) | 1360 | Messenger *new_messenger(uint8_t ipv6enabled) |
1361 | { | 1361 | { |
1362 | Messenger *m = calloc(1, sizeof(Messenger)); | 1362 | Messenger *m = calloc(1, sizeof(Messenger)); |
1363 | 1363 | ||
@@ -1402,7 +1402,7 @@ Messenger *initMessenger(uint8_t ipv6enabled) | |||
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | /* Run this before closing shop. */ | 1404 | /* Run this before closing shop. */ |
1405 | void cleanupMessenger(Messenger *m) | 1405 | void kill_messenger(Messenger *m) |
1406 | { | 1406 | { |
1407 | /* FIXME TODO: ideally cleanupMessenger will mirror initMessenger. | 1407 | /* FIXME TODO: ideally cleanupMessenger will mirror initMessenger. |
1408 | * This requires the other modules to expose cleanup functions. | 1408 | * This requires the other modules to expose cleanup functions. |
@@ -1415,7 +1415,7 @@ void cleanupMessenger(Messenger *m) | |||
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | /* TODO: Make this function not suck. */ | 1417 | /* TODO: Make this function not suck. */ |
1418 | void doFriends(Messenger *m) | 1418 | void do_friends(Messenger *m) |
1419 | { | 1419 | { |
1420 | /* TODO: Add incoming connections and some other stuff. */ | 1420 | /* TODO: Add incoming connections and some other stuff. */ |
1421 | uint32_t i; | 1421 | uint32_t i; |
@@ -1725,7 +1725,7 @@ void doFriends(Messenger *m) | |||
1725 | } | 1725 | } |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | void doInbound(Messenger *m) | 1728 | void do_inbound(Messenger *m) |
1729 | { | 1729 | { |
1730 | uint8_t secret_nonce[crypto_box_NONCEBYTES]; | 1730 | uint8_t secret_nonce[crypto_box_NONCEBYTES]; |
1731 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; | 1731 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; |
@@ -1767,14 +1767,14 @@ static char *ID2String(uint8_t *client_id) | |||
1767 | #endif | 1767 | #endif |
1768 | 1768 | ||
1769 | /* The main loop that needs to be run at least 20 times per second. */ | 1769 | /* The main loop that needs to be run at least 20 times per second. */ |
1770 | void doMessenger(Messenger *m) | 1770 | void do_messenger(Messenger *m) |
1771 | { | 1771 | { |
1772 | networking_poll(m->net); | 1772 | networking_poll(m->net); |
1773 | 1773 | ||
1774 | do_DHT(m->dht); | 1774 | do_DHT(m->dht); |
1775 | do_net_crypto(m->net_crypto); | 1775 | do_net_crypto(m->net_crypto); |
1776 | doFriends(m); | 1776 | do_friends(m); |
1777 | doInbound(m); | 1777 | do_inbound(m); |
1778 | do_allgroupchats(m); | 1778 | do_allgroupchats(m); |
1779 | LANdiscovery(m); | 1779 | LANdiscovery(m); |
1780 | 1780 | ||
@@ -1873,17 +1873,17 @@ void doMessenger(Messenger *m) | |||
1873 | /* | 1873 | /* |
1874 | * functions to avoid excessive polling | 1874 | * functions to avoid excessive polling |
1875 | */ | 1875 | */ |
1876 | int waitprepareMessenger(Messenger *m, uint8_t *data, uint16_t *lenptr) | 1876 | int wait_prepare_messenger(Messenger *m, uint8_t *data, uint16_t *lenptr) |
1877 | { | 1877 | { |
1878 | return networking_wait_prepare(m->net, sendqueue_total(m->net_crypto->lossless_udp), data, lenptr); | 1878 | return networking_wait_prepare(m->net, sendqueue_total(m->net_crypto->lossless_udp), data, lenptr); |
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | int waitexecuteMessenger(Messenger *m, uint8_t *data, uint16_t len, uint16_t milliseconds) | 1881 | int wait_execute_messenger(Messenger *m, uint8_t *data, uint16_t len, uint16_t milliseconds) |
1882 | { | 1882 | { |
1883 | return networking_wait_execute(data, len, milliseconds); | 1883 | return networking_wait_execute(data, len, milliseconds); |
1884 | }; | 1884 | }; |
1885 | 1885 | ||
1886 | void waitcleanupMessenger(Messenger *m, uint8_t *data, uint16_t len) | 1886 | void wait_cleanup_messenger(Messenger *m, uint8_t *data, uint16_t len) |
1887 | { | 1887 | { |
1888 | networking_wait_cleanup(m->net, data, len); | 1888 | networking_wait_cleanup(m->net, data, len); |
1889 | } | 1889 | } |
@@ -2037,7 +2037,7 @@ static int Messenger_load_old(Messenger *m, uint8_t *data, uint32_t length) | |||
2037 | #define MESSENGER_STATE_TYPE_NAME 4 | 2037 | #define MESSENGER_STATE_TYPE_NAME 4 |
2038 | 2038 | ||
2039 | /* return size of the messenger data (for saving) */ | 2039 | /* return size of the messenger data (for saving) */ |
2040 | uint32_t Messenger_size(Messenger *m) | 2040 | uint32_t messenger_size(Messenger *m) |
2041 | { | 2041 | { |
2042 | uint32_t size32 = sizeof(uint32_t), sizesubhead = size32 * 2; | 2042 | uint32_t size32 = sizeof(uint32_t), sizesubhead = size32 * 2; |
2043 | return size32 * 2 // global cookie | 2043 | return size32 * 2 // global cookie |
@@ -2058,7 +2058,7 @@ static uint8_t *z_state_save_subheader(uint8_t *data, uint32_t len, uint16_t typ | |||
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | /* Save the messenger in data of size Messenger_size(). */ | 2060 | /* Save the messenger in data of size Messenger_size(). */ |
2061 | void Messenger_save(Messenger *m, uint8_t *data) | 2061 | void messenger_save(Messenger *m, uint8_t *data) |
2062 | { | 2062 | { |
2063 | uint32_t len; | 2063 | uint32_t len; |
2064 | uint16_t type; | 2064 | uint16_t type; |
@@ -2161,7 +2161,7 @@ static int messenger_load_state_callback(void *outer, uint8_t *data, uint32_t le | |||
2161 | } | 2161 | } |
2162 | 2162 | ||
2163 | /* Load the messenger from data of size length. */ | 2163 | /* Load the messenger from data of size length. */ |
2164 | int Messenger_load(Messenger *m, uint8_t *data, uint32_t length) | 2164 | int messenger_load(Messenger *m, uint8_t *data, uint32_t length) |
2165 | { | 2165 | { |
2166 | uint32_t cookie_len = 2 * sizeof(uint32_t); | 2166 | uint32_t cookie_len = 2 * sizeof(uint32_t); |
2167 | 2167 | ||