indrora / Atomic

Atomic: an IRC client from the ashes of yaaic
https://indrora.github.io/Atomic/
GNU General Public License v3.0
124 stars 29 forks source link

Reconnection feature is un-intuitive, sometimes clears the backlog #52

Open qwertfisch opened 10 years ago

qwertfisch commented 10 years ago

About the automatic reconnect feature, I cannot get the full grasp how this works. Mostly when I am sitting in the train and the connection gets lost, I just continue typing and after some time Atomic reconnects. But when I put the phone on standby (with Atomic in foreground) after connection lost and open it up a few minutes later, in most cases Atomic asks me with a popup if I want to reconnect this server. Event if it already had reconnected in the background. What should I press? Yes? No? Either option does nothing, but I don’t know what to press.

It gets worse if Atomic already reconnected in background and lost connection again. Clicking no does quite nothing and it will not get the conection again. Clicking yes could work … have to try out.

In some cases the backlog will be cleared. I think it’s when I click No on the popup message. I cannot say for sure, most channels aren’t so chatty to test properly. And it happens of course when I have to manually disconnect because Atomic won’t reconnect even with a connection.

Maybe at least the pop-up meaning could be explained, and what option does what (because I have automatic reconnect set, so why the popup?).

qwertfisch commented 10 years ago

More details:

I was connected to a network, the smartphone in standby mode. From the channel server log I can see that Atomic at some point disconnected, waited 30 seconds, reconnected. Then just two seconds later it disconnected again. Here is the log:

[18:02:20] Connected to Quakenet
[18:02:20] Now logging in…
[18:02:21] Server login done.
[18:02:21] MOTD suppressed. To see it, use the ‘/motd’ command.
[18:24:28] Disconnected
[18:24:49] Waiting on network connectivity
[18:24:49] Connected to Quakenet
[18:24:49] Now logging in…
[18:24:50] Server login done.
[18:24:51] MOTD suppressed. To see it, use the ‘/motd’ command.
[18:24:51] Disconnected

All opened channels were closed. The server stayed disconnected even when there was mobile reception. I wasn’t able to select connect for the server unless I explicitly selected Disconnect first.

This is a bad behaviour because

  1. I cannot trust the automatic to reconnect by itself.
  2. All channels with possibly received messages were lost for the moment (I have them logged by ZNC, but that’s not the point).
indrora commented 10 years ago

I'll be rebuilding the reconnection logic -- most of it is caused by not setting the state of a server which is going to be reconnected as "reconnecting" -- I'll keep this around so I can track it.

As for the clearing of the buffer? That's Android doing that in low-memory situations and reaping back conversations which have lost their parent connection.

qwertfisch commented 9 years ago

Well, the reconnection logic is more or less instable, but I can accept that. If I know I will get into bad reception, I manually disconnect before.

About clearing the buffer: I beg to differ, the clearing only happens on periods with mentioned broken disconnections. When the connection is stable, I can have a dozen channels with each 200+ entries open and not losing any message. My phone has 1,5GB RAM and most of it free. So I presume it is more an error on the reconnection code of Atomic which clears the channel log deliberately.

indrora commented 9 years ago

In current commits, I've reworked it. Since Android has some backwards ways of handling network transition, I've changed it in current commits to be one of three conditions which will cause a reconnect request:

qwertfisch commented 9 years ago

Sounds good, I will try it this week. :+1: What happens if I click on cancel? Can I manually reconnect, because in previous versions the server state is kind of undefined. It is logically connected but not really. To reconnect I have to disconnect first, then reconnect the server again. That way the log would be lost, which I’d rather keep for my session.

indrora commented 9 years ago

I'm going to add a manual reconnect entry in the menu. On Nov 17, 2014 12:19 PM, "qwertfisch" notifications@github.com wrote:

Sounds good, I will try it this week. [image: :+1:] What happens if I click on cancel? Can I manually reconnect, because in previous versions the server state is kind of undefined. It is logically connected but not really. To reconnect I have to disconnect first, then reconnect the server again. That way the log would be lost, which I’d rather keep for my session.

— Reply to this email directly or view it on GitHub https://github.com/indrora/Atomic/issues/52#issuecomment-63359075.

qwertfisch commented 9 years ago

That would be great, thank you.