evilcorpltd / aTox

Reasonable Tox client for Android
GNU General Public License v3.0
372 stars 59 forks source link

some messages gets lost on poor connection #1161

Open readyblue opened 1 year ago

readyblue commented 1 year ago

Hi @robinlinden Robin,

I have noticed lately, that on some cases with poor wifi the messages send from aTox does not get delivered.
While TOX implements read receipts, would be possible to implement mechanism that sends message only after the read receipts gets delivered from previous message? And also display this event in the chat log window so that it will be possible to resend the message without read receipts delivered?

As it is better to even send message twice than loose it.

Thanks for aTox in any way.

robinlinden commented 1 year ago

Hi @readyblue!

While TOX implements read receipts, would be possible to implement mechanism that sends message only after the read receipts gets delivered from previous message?

aTox should already be resending all undelivered messages in the correct order, but we don't wait for one message to be acknowledged before sending the next, ~so I guess in theory a message could get lost a second time, and then we'd end up with out-of-order problems. If you feel like having a look at making a PR for this, it'd be very welcome. :)~ After speaking to a friend, this shouldn't be able to happen either. Have you had messages delivered out-of-order from aTox to aTox, uTox, Toxic, or qTox?

See: https://github.com/evilcorpltd/aTox/blob/b3684d88c416670546667d529db8759ad62d9bac/domain/src/main/kotlin/feature/ChatManager.kt#L88-L101

https://github.com/evilcorpltd/aTox/blob/b3684d88c416670546667d529db8759ad62d9bac/atox/src/main/kotlin/tox/EventListenerCallbacks.kt#L96-L103

And also display this event in the chat log window so that it will be possible to resend the message without read receipts delivered?

aTox already resends all messages that it doesn't get read-receipts for, so if aTox doesn't display "sending" under a message, the Tox client on the other side has sent a read-receipt. Are you sure it's not the other side dropping the messages after receiving them and sending a read-receipt?

See: https://github.com/evilcorpltd/aTox/blob/b3684d88c416670546667d529db8759ad62d9bac/domain/src/main/kotlin/feature/ChatManager.kt#L62-L83 https://github.com/evilcorpltd/aTox/blob/b3684d88c416670546667d529db8759ad62d9bac/atox/src/main/kotlin/tox/EventListenerCallbacks.kt#L88-L90 https://github.com/evilcorpltd/aTox/blob/b3684d88c416670546667d529db8759ad62d9bac/atox/src/main/kotlin/ui/chat/ChatAdapter.kt#L138-L144

Thank you for getting in touch! Always nice to hear from people using aTox!

readyblue commented 1 year ago

With all due respect, there may be a reason why it might be a good idea to keep message delivery in order, like: meme_msg_not_delivered_in_order