diff options
author | irungentoo <irungentoo@gmail.com> | 2013-10-20 15:12:46 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-10-20 15:12:46 -0400 |
commit | 9303c18b0c4d0156607d0050a32be5d96569f21c (patch) | |
tree | 4bf60f6adbe98d5c2400e3fcd5677e941b58c50e /toxcore/Messenger.c | |
parent | 1ad9e6d8ac52589ccc1367c2bbe9d02dcc1e460a (diff) | |
parent | a0f08839bd134f3f964a6cccf1243cd42f15d4e5 (diff) |
Merge branch 'Cleanup-defines' of https://github.com/FullName/ProjectTox-Core into FullName-Cleanup-defines
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 76f2a5fd..2e8efeac 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1759,7 +1759,7 @@ static char *ID2String(uint8_t *client_id) | |||
1759 | uint32_t i; | 1759 | uint32_t i; |
1760 | 1760 | ||
1761 | for (i = 0; i < CLIENT_ID_SIZE; i++) | 1761 | for (i = 0; i < CLIENT_ID_SIZE; i++) |
1762 | sprintf(&IDString[i], "%02X", client_id[i]); | 1762 | sprintf(&IDString[i * 2], "%02X", client_id[i]); |
1763 | 1763 | ||
1764 | IDString[CLIENT_ID_SIZE * 2] = 0; | 1764 | IDString[CLIENT_ID_SIZE * 2] = 0; |
1765 | return IDString; | 1765 | return IDString; |
@@ -1789,24 +1789,20 @@ void doMessenger(Messenger *m) | |||
1789 | for (client = 0; client < LCLIENT_LIST; client++) { | 1789 | for (client = 0; client < LCLIENT_LIST; client++) { |
1790 | Client_data *cptr = &m->dht->close_clientlist[client]; | 1790 | Client_data *cptr = &m->dht->close_clientlist[client]; |
1791 | IPPTsPng *assoc = NULL; | 1791 | IPPTsPng *assoc = NULL; |
1792 | #ifdef CLIENT_ONETOONE_IP | ||
1793 | assoc = &cptr->assoc; | ||
1794 | #else | ||
1795 | uint32_t a; | 1792 | uint32_t a; |
1796 | 1793 | ||
1797 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) | 1794 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) |
1798 | #endif | 1795 | if (ip_isset(&assoc->ip_port.ip)) { |
1799 | if (ip_isset(&assoc->ip_port.ip)) { | 1796 | last_pinged = lastdump - assoc->last_pinged; |
1800 | last_pinged = lastdump - assoc->last_pinged; | ||
1801 | 1797 | ||
1802 | if (last_pinged > 999) | 1798 | if (last_pinged > 999) |
1803 | last_pinged = 999; | 1799 | last_pinged = 999; |
1804 | 1800 | ||
1805 | snprintf(logbuffer, sizeof(logbuffer), "C[%2u] %s:%u [%3u] %s\n", | 1801 | snprintf(logbuffer, sizeof(logbuffer), "C[%2u] %s:%u [%3u] %s\n", |
1806 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), | 1802 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), |
1807 | last_pinged, ID2String(cptr->client_id)); | 1803 | last_pinged, ID2String(cptr->client_id)); |
1808 | loglog(logbuffer); | 1804 | loglog(logbuffer); |
1809 | } | 1805 | } |
1810 | } | 1806 | } |
1811 | 1807 | ||
1812 | loglog(" = = = = = = = = \n"); | 1808 | loglog(" = = = = = = = = \n"); |
@@ -1850,25 +1846,21 @@ void doMessenger(Messenger *m) | |||
1850 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { | 1846 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { |
1851 | Client_data *cptr = &dhtfptr->client_list[client]; | 1847 | Client_data *cptr = &dhtfptr->client_list[client]; |
1852 | IPPTsPng *assoc = NULL; | 1848 | IPPTsPng *assoc = NULL; |
1853 | #ifdef CLIENT_ONETOONE_IP | ||
1854 | assoc = &cptr->assoc; | ||
1855 | #else | ||
1856 | uint32_t a; | 1849 | uint32_t a; |
1857 | 1850 | ||
1858 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) | 1851 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) |
1859 | #endif | 1852 | if (ip_isset(&assoc->ip_port.ip)) { |
1860 | if (ip_isset(&assoc->ip_port.ip)) { | 1853 | last_pinged = lastdump - assoc->last_pinged; |
1861 | last_pinged = lastdump - assoc->last_pinged; | ||
1862 | 1854 | ||
1863 | if (last_pinged > 999) | 1855 | if (last_pinged > 999) |
1864 | last_pinged = 999; | 1856 | last_pinged = 999; |
1865 | 1857 | ||
1866 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", | 1858 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", |
1867 | friend, client, ip_ntoa(&assoc->ip_port.ip), | 1859 | friend, client, ip_ntoa(&assoc->ip_port.ip), |
1868 | ntohs(assoc->ip_port.port), last_pinged, | 1860 | ntohs(assoc->ip_port.port), last_pinged, |
1869 | ID2String(cptr->client_id)); | 1861 | ID2String(cptr->client_id)); |
1870 | loglog(logbuffer); | 1862 | loglog(logbuffer); |
1871 | } | 1863 | } |
1872 | } | 1864 | } |
1873 | } | 1865 | } |
1874 | 1866 | ||