singpolyma / cheogram

Moved to https://git.singpolyma.net/cheogram
https://cheogram.com
GNU Affero General Public License v3.0
27 stars 5 forks source link

How can I tell when the remote server restarts? #36

Closed singpolyma closed 8 years ago

singpolyma commented 8 years ago

Every time yax.im restarts all cheogram users lose room membership. They don't even get told they are kicked out, cheogram think they are in but they are not.

Looking at logs, I don't see anything telling me remote is gone. How do clients normally handle this?

singpolyma commented 8 years ago

http://mail.jabber.org/pipermail/jdev/2016-March/090210.html

Support iq pings. https://xmpp.org/extensions/xep-0199.html If a ping fails, try to join again. Merge this re-join mechanism with the re-joins we do on full cheogram restart so it all works the same way.

singpolyma commented 8 years ago

If we do get "unavailable" with 332, then instead of telling the user they've been kicked, we should do the same thing as in a ping failure case

singpolyma commented 8 years ago

I should be in my own list of who I think is in the room. So falsePresence can probably go away completely and rely on my own list not getting mutated except by me seeing things.

So, if we just send the join as per normal, everything should work (as long as the room still exists).

The problem if the room goes away is that we want to re-create the room settings (members-only, everyone as an owner).

Cheogram should set rooms to persistent (instead of not as now), then we don't have this issue. It's not our job to re-set-up someone else's temporary room. So let's set ours to persistent on creation. Then we can assume our rooms exist, and non-existent rooms we just all pile in with the default settings for the server (what else can we do?)

On Cheogram restart, blindly send re-join for everyone. What's the downside? Don't need to check who is or is not in the room or if the room exists. On ping fail, send rejoin. On 332, send rejoin. Cheogram will ignore PresenceAvailable from people our users thought were in the room anyway.

So, then, if we get a CHEOGRAMREJOIN presence error from a MUC, spawn a thread that waits a random amount of time and then pretends a ping failed again. That way we keep re-trying the join until the server comes back.