Bug 12369 - Disconnection not handled correctly
: Disconnection not handled correctly
Status: CLOSED FIXED
Product: Miniature
UI
: master
: N950 Harmattan
: High major (vote)
: 0.4
Assigned To: Michael Hasselmann
: general
:
:
: 12363
:
  Show dependency tree
 
Reported: 2011-09-02 10:13 UTC by Uwe Kaminski
Modified: 2011-09-18 07:58 UTC (History)
3 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Uwe Kaminski (reporter) 2011-09-02 10:13:13 UTC
SOFTWARE VERSION: 
master

EXACT STEPS LEADING TO PROBLEM: 
1. Run Miniature
2. Run an other chess client (e.g. on desktop)
3. Disable Testing Mode in Minature
4. Connect to FICS server using both Miniature and the second client and run a
game using both clients
5. disconnect the desktop client (e.g. disable network connection in system)

EXPECTED OUTCOME: 
In Miniature the same dialog appears as shown by tapping the back arrow first
and "Testing connection lost" second in the bottom left corner if board is
shown.

ACTUAL OUTCOME:
Nothing happens in Miniature client.

REPRODUCIBILITY: 
always
Comment 1 Uwe Kaminski (reporter) 2011-09-02 10:14:41 UTC
In my opinion this should work in 0.4. Please set target if you agree,
Quim/Michael.
Comment 2 Quim Gil 2011-09-02 22:24:33 UTC
Do we need another signal in addition to onSeekCancelled and onGameStarted?

When the game is cancelled because the opponent has vanished a dialog should
appear, and pressing OK should send the user to SeekGame and be presented a
cleared list of items starting from scratch.

We are still fixing SeekGame for cancelled seeks, hence making this a
dependency of Bug 12363
Comment 3 Michael Hasselmann 2011-09-06 00:44:24 UTC
FICS handles disconnects as game aborts, and as such, game aborts are on our
list for 0.4 already.

Expected outcome is incorrect: It is not *us* that disconnect from FICS, but
the opponent. Disconnect dialog is meant for the former.

What should happen instead is that the game aborted dialog pops up, perhaps
giving a specific reason such as "Opponent disconnected."
Comment 4 Michael Hasselmann 2011-09-06 05:02:30 UTC
Commit 680a01beb8ce46d0b04f7edddeecb3cb70fb1ed9 implements the new
Miniature::gameEnded signal. Currently only works for forfeit-by-disconnect.

UI needs to show a dialog for this.
Comment 5 Michael Hasselmann 2011-09-06 05:07:34 UTC
Question is now for me: How should the backend behave if opponent disconnects?
Just dispose of the game?
Comment 6 Quim Gil 2011-09-06 09:01:19 UTC
Dialog for gameEnded --> opponent disconnects.

It works (tested with desktop + Miniature) but I still haven't found the
way to print the variables for "reason" and "result". Once I know this
then I can edit the UI to have a more explanatory dialog and also can
make the Connections ready for different types of gameEnded.

http://gitorious.org/miniature/miniature/commit/b2b56e83ce8f17b46f2da7c8752023bfa15ab5be


I wonder if always the scenario for a remote disconnection is an adjudication
for the local side? When the local side is a guest then yes, the game is
unrated and it's simply adjudicated to the "survivor". But with registered
players on a rated game I think there are two scenarios:

- Disconnection means courtesyAdjourn.
- Disconnection means victory for the survivor.

Not sure when happens what. In any case the dialog should explain what is going
on... maybe after 0.4.  ;)

After the user presses OK, OnlineBoard is closed and the user goes back to
SeekGame (this already happens), where new seeks show up (this doesn't happen
evn if they show up in console, but this is food for Bug 12340)
Comment 7 Uwe Kaminski (reporter) 2011-09-06 09:31:37 UTC
(In reply to comment #6)
> I wonder if always the scenario for a remote disconnection is an adjudication
> for the local side? When the local side is a guest then yes, the game is
> unrated and it's simply adjudicated to the "survivor". But with registered
> players on a rated game I think there are two scenarios:
> 
> - Disconnection means courtesyAdjourn.
> - Disconnection means victory for the survivor.
> 
> Not sure when happens what. In any case the dialog should explain what is going
> on... maybe after 0.4.  ;)

Pleas don't forget the case that the opponent was able to re-login and asks for
"resume". How to handle this? There should be a "notification" area or at least
a terminal output window to handle this. But also in post 0.4
Comment 8 Quim Gil 2011-09-06 17:46:01 UTC
(In reply to comment #7)
> Pleas don't forget the case that the opponent was able to re-login and asks for
> "resume". How to handle this? There should be a "notification" area or at least
> a terminal output window to handle this. But also in post 0.4

Resuming games is a separate feature altogether. I just created bug 12376 -
Miniature should be able to resume adjourned FICS games
Comment 9 Quim Gil 2011-09-06 20:46:11 UTC
Now the GameEnded signal is handled properly. Thanks mikhas for your
instructions at #miniature!

Committed to master:
https://gitorious.org/miniature/miniature/commit/402f0dc1b6ed60b9c9b11a8852945d9f7cf516ca

I think the only thing missing to solve this bug completely is to add an option
for Adjourned in the backend (I would just do it as a result next to WhiteWins
etc even if it's not a GameEnded in strictu sensu).

This way we can handle the opponent disconnections no matter how FICS decides
to resolve the case.
Comment 10 Quim Gil 2011-09-07 00:24:10 UTC
I have added two more FICS messages parsed at engine.cc:
https://gitorious.org/miniature/miniature/commit/258d68529a6e3ae3389ec6c5015aae79682de689 

... and that's all I knew or dared to do in the backend. Sorry mikhas but I
still have it too much respect.

One is a game abort and the other is a game adjourned. Both end with a single
character "*". 

I believe with this we have all the disconnection cases covered:
http://www.freechess.org/Help/HelpFiles/disconnection.html
Comment 11 Michael Hasselmann 2011-09-07 01:01:04 UTC
Thanks for doing the basic regex work, I'll add a test for it and hook it up to
the GameEnded command. Taking this bug back for now.
Comment 12 Quim Gil 2011-09-07 21:17:40 UTC
After
https://gitorious.org/miniature/miniature/commit/3f330eae881e1e88da2843b924bd8c2411a285eb
the user experience of a disconnected game has improved a bit: when the local
user clicks OK in the remote disconnection dialog he goes back to SeekGame,
which contains 0 items listed (instead of old ones, as happened before).

What still needs to be done is to set m_filter &= WaitForSeeks in order to make
new resulsts show up. Sorry, I couldn't find the way to do this myself.
Comment 13 Michael Hasselmann 2011-09-08 03:15:30 UTC
We now handle removed seeks that became invalid through disconnect/declines and
games that ended through disconnects and were aborted, lost or adjourned.

Would consider this bug as fixed, at least in the scope of 0.4

Auto-resume after disconnect is a post 0.4 feature, sorry.
Comment 14 Quim Gil 2011-09-08 09:17:24 UTC
I think you went a bit fast resolving this bug as FIXED...  :)

After
https://gitorious.org/miniature/miniature/commit/3428344a47168f736179f08d2f9caf192751a2d2
it is indeed fixed and ready for verification.

WaitForSeeks still needs to be activated but this is the same for any game
resolution implying a step back to SeekGames and we still must implement them.
Comment 15 Michael Hasselmann 2011-09-08 11:06:05 UTC
(In reply to comment #14)
> I think you went a bit fast resolving this bug as FIXED...  :)
> 
> After
> https://gitorious.org/miniature/miniature/commit/3428344a47168f736179f08d2f9caf192751a2d2
> it is indeed fixed and ready for verification.

It was late - thanks.
Comment 16 Quim Gil 2011-09-10 21:53:59 UTC
Tested dozens of times with many scenarios guest / registered, rated / unrated.
Verifying.
Comment 17 Michael Hasselmann 2011-09-10 22:35:46 UTC
We still need a way to report when the player's client disconnected.