summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/Messenger.c8
-rw-r--r--toxcore/tox.c2
2 files changed, 10 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 472550a6..c45debed 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1856,6 +1856,13 @@ int m_callback_rtp_packet(Messenger *m, int32_t friendnumber, uint8_t byte, m_lo
1856} 1856}
1857 1857
1858 1858
1859/* TODO(oxij): this name is confusing, because this function sends both av and custom lossy packets.
1860 * Meanwhile, m_handle_lossy_packet routes custom packets to custom_lossy_packet_registerhandler
1861 * as you would expect from its name.
1862 *
1863 * I.e. custom_lossy_packet_registerhandler's "custom lossy packet" and this "custom lossy packet"
1864 * are not the same set of packets.
1865 */
1859int m_send_custom_lossy_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t length) 1866int m_send_custom_lossy_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t length)
1860{ 1867{
1861 if (friend_not_valid(m, friendnumber)) { 1868 if (friend_not_valid(m, friendnumber)) {
@@ -1866,6 +1873,7 @@ int m_send_custom_lossy_packet(const Messenger *m, int32_t friendnumber, const u
1866 return -2; 1873 return -2;
1867 } 1874 }
1868 1875
1876 // TODO(oxij): send_lossy_cryptpacket makes this check already, similarly for other similar places
1869 if (data[0] < PACKET_ID_RANGE_LOSSY_START || data[0] > PACKET_ID_RANGE_LOSSY_END) { 1877 if (data[0] < PACKET_ID_RANGE_LOSSY_START || data[0] > PACKET_ID_RANGE_LOSSY_END) {
1870 return -3; 1878 return -3;
1871 } 1879 }
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 95acfd2a..80ff42c3 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -1522,6 +1522,8 @@ bool tox_friend_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_
1522 return 0; 1522 return 0;
1523 } 1523 }
1524 1524
1525 // TODO(oxij): this feels ugly, this is needed only because m_send_custom_lossy_packet in Messenger.c
1526 // sends both AV and custom packets despite its name and this API hides those AV packets
1525 if (data[0] <= PACKET_ID_RANGE_LOSSY_AV_END) { 1527 if (data[0] <= PACKET_ID_RANGE_LOSSY_AV_END) {
1526 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_INVALID); 1528 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_INVALID);
1527 return 0; 1529 return 0;