Last active
June 30, 2022 10:51
-
-
Save zoff99/ffafeeb74a51ffbf001777ad1e205818 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tox MessageV3 (alias Hubble telescope glasses)
proposal to transpartently patch current text messages to fix double messages and missed messages (and to support history sync in the future)
new defines:
new message type:
tweak in Messenger.c in m_handle_packet():
tweak in Messenger.c in m_send_message_generic():
sending and receiving msgV3:
raw data:
sending description:
the client needs to use the new msgV3 format for text messages.
msg id will be a 32 byte hash value calculated the same way as now for filetransfers.
a helper function will be added to do that.
a client needs to save the created msd ig and the timstamp, to be able to resend the exact same data when a high level ACK was not received.
receiving description:
the maximum real text playload will decrease to 1334 bytes.
cients not using msgV3 will just process the message text up to the first NULL byte when interpreted as UTF-8.
if a client is using the data for other things as UTF-8 text, then that client needs to account for that.
clients using msgV3, will check for the guard and use the remaining data as uniqe message ID and unix timestamp in UTC wall clock time.
after fully processing the message, the client then needs to send the high level ACK with that msd id.
what happens if a malicious client sends the guard and then some random data?
then a bogus msg id and bogus timestamp will be received. so if messages are ordered by this timestamp, then message ordering will be wrong
for this single message.
are there other possible problematic things that can happen?
sending and receiving high level ACK:
raw data:
send the high level ACK as new message type. get a new uniqe hash with the new helper function.
new clients know which messages was received and also get the proper receive timestamp.
old clients will just ignore the unknown message type.
in case some older clients just display any message type from the callback, we include a valid UTF-8 text as '_' with NULL termination.
add helper functions for receiving:
pros:
cons: