The International Simutrans Forum

 

Author Topic: Game unresponsive whilst attempting to contact the listserver  (Read 529 times)

0 Members and 1 Guest are viewing this topic.

Offline Freahk

  • Devotee
  • *
  • Posts: 1473
  • Languages: DE, EN
Game unresponsive whilst attempting to contact the listserver
« on: August 21, 2020, 01:21:50 PM »
I am not exactly sure if this issue still exists in standard, but it once did. So if it was fixed in the past, please let me know and move the thread.

When the list server is queried, e.g. when opening the "Play Online" dialogue, the game will be unresponsive until it either gets a response from the listserver or the action times out.
Same goes for querying a server, though it's not that bad here, as it will time out much faster.

Optimally the dialogue would open empty without these informations available, run the query in the background and update the dialogue as soon as the information is available.

I am aware that this is some kind of "in a perfect world" situation and likely needs a lot of changes in the code, so the easy solution would be to set a lower timeout. The current value feels like ages of unresponsivenes and will report as "simutrans is unresponsive" in some operating systems.

Is there any specific reason for that long timeout or can this be changed?

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1432
Re: Game unresponsive whilst attempting to contact the listserver
« Reply #1 on: August 21, 2020, 04:55:23 PM »
IIRC the timeout value is left to the operating system.  Also IIRC having Simutrans implement its own timeout would need a lot of OS specific code (and testing/maintenance that goes along with that).
All the Simutrans networking code / main loop is single threaded, so no easy background queries either.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10577
  • Languages: De,EN,JP
Re: Game unresponsive whilst attempting to contact the listserver
« Reply #2 on: August 22, 2020, 01:24:52 PM »
The timeout is 10s for most Unixes and 30-40s for Windows. This is can be changed by fiddling in the registry but not otherwise at program level in the socket/connect routines. (I found that the ARP layer may help, but this is beyond what my network knowledge can do.) So nice to have but difficult.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5691
  • Languages: EN, NO
Re: Game unresponsive whilst attempting to contact the listserver
« Reply #3 on: August 23, 2020, 06:53:34 AM »
It should be possible to set the socket (temporarily) to non-blocking, and then use select with the desired timeout for waiting. There is still the question of how long to wait.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10577
  • Languages: De,EN,JP
Re: Game unresponsive whilst attempting to contact the listserver
« Reply #4 on: August 23, 2020, 12:55:33 PM »
Ok, I found something here http://developerweb.net/viewtopic.php?id=3196. Geven the already long code, I am somehow reluctant to add this monster into it.

Attempts to use SO_SNDTIMEO do not work on windows.