diff options
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 44570742..6764dfe3 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1700,7 +1700,7 @@ static char *ID2String(uint8_t *client_id) | |||
1700 | uint32_t i; | 1700 | uint32_t i; |
1701 | 1701 | ||
1702 | for (i = 0; i < CLIENT_ID_SIZE; i++) | 1702 | for (i = 0; i < CLIENT_ID_SIZE; i++) |
1703 | sprintf(&IDString[i], "%02X", client_id[i]); | 1703 | sprintf(&IDString[i * 2], "%02X", client_id[i]); |
1704 | 1704 | ||
1705 | IDString[CLIENT_ID_SIZE * 2] = 0; | 1705 | IDString[CLIENT_ID_SIZE * 2] = 0; |
1706 | return IDString; | 1706 | return IDString; |
@@ -1730,24 +1730,20 @@ void doMessenger(Messenger *m) | |||
1730 | for (client = 0; client < LCLIENT_LIST; client++) { | 1730 | for (client = 0; client < LCLIENT_LIST; client++) { |
1731 | Client_data *cptr = &m->dht->close_clientlist[client]; | 1731 | Client_data *cptr = &m->dht->close_clientlist[client]; |
1732 | IPPTsPng *assoc = NULL; | 1732 | IPPTsPng *assoc = NULL; |
1733 | #ifdef CLIENT_ONETOONE_IP | ||
1734 | assoc = &cptr->assoc; | ||
1735 | #else | ||
1736 | uint32_t a; | 1733 | uint32_t a; |
1737 | 1734 | ||
1738 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) | 1735 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) |
1739 | #endif | 1736 | if (ip_isset(&assoc->ip_port.ip)) { |
1740 | if (ip_isset(&assoc->ip_port.ip)) { | 1737 | last_pinged = lastdump - assoc->last_pinged; |
1741 | last_pinged = lastdump - assoc->last_pinged; | ||
1742 | 1738 | ||
1743 | if (last_pinged > 999) | 1739 | if (last_pinged > 999) |
1744 | last_pinged = 999; | 1740 | last_pinged = 999; |
1745 | 1741 | ||
1746 | snprintf(logbuffer, sizeof(logbuffer), "C[%2u] %s:%u [%3u] %s\n", | 1742 | snprintf(logbuffer, sizeof(logbuffer), "C[%2u] %s:%u [%3u] %s\n", |
1747 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), | 1743 | client, ip_ntoa(&assoc->ip_port.ip), ntohs(assoc->ip_port.port), |
1748 | last_pinged, ID2String(cptr->client_id)); | 1744 | last_pinged, ID2String(cptr->client_id)); |
1749 | loglog(logbuffer); | 1745 | loglog(logbuffer); |
1750 | } | 1746 | } |
1751 | } | 1747 | } |
1752 | 1748 | ||
1753 | loglog(" = = = = = = = = \n"); | 1749 | loglog(" = = = = = = = = \n"); |
@@ -1791,25 +1787,21 @@ void doMessenger(Messenger *m) | |||
1791 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { | 1787 | for (client = 0; client < MAX_FRIEND_CLIENTS; client++) { |
1792 | Client_data *cptr = &dhtfptr->client_list[client]; | 1788 | Client_data *cptr = &dhtfptr->client_list[client]; |
1793 | IPPTsPng *assoc = NULL; | 1789 | IPPTsPng *assoc = NULL; |
1794 | #ifdef CLIENT_ONETOONE_IP | ||
1795 | assoc = &cptr->assoc; | ||
1796 | #else | ||
1797 | uint32_t a; | 1790 | uint32_t a; |
1798 | 1791 | ||
1799 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) | 1792 | for (a = 0, assoc = &cptr->assoc4; a < 2; a++, assoc = &cptr->assoc6) |
1800 | #endif | 1793 | if (ip_isset(&assoc->ip_port.ip)) { |
1801 | if (ip_isset(&assoc->ip_port.ip)) { | 1794 | last_pinged = lastdump - assoc->last_pinged; |
1802 | last_pinged = lastdump - assoc->last_pinged; | ||
1803 | 1795 | ||
1804 | if (last_pinged > 999) | 1796 | if (last_pinged > 999) |
1805 | last_pinged = 999; | 1797 | last_pinged = 999; |
1806 | 1798 | ||
1807 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", | 1799 | snprintf(logbuffer, sizeof(logbuffer), "F[%2u] => C[%2u] %s:%u [%3u] %s\n", |
1808 | friend, client, ip_ntoa(&assoc->ip_port.ip), | 1800 | friend, client, ip_ntoa(&assoc->ip_port.ip), |
1809 | ntohs(assoc->ip_port.port), last_pinged, | 1801 | ntohs(assoc->ip_port.port), last_pinged, |
1810 | ID2String(cptr->client_id)); | 1802 | ID2String(cptr->client_id)); |
1811 | loglog(logbuffer); | 1803 | loglog(logbuffer); |
1812 | } | 1804 | } |
1813 | } | 1805 | } |
1814 | } | 1806 | } |
1815 | 1807 | ||