The International Simutrans Forum

Development => Bug Reports => Known bugs and features => Topic started by: Freahk on August 21, 2020, 01:21:50 PM

Title: Game unresponsive whilst attempting to contact the listserver
Post by: Freahk 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?
Title: Re: Game unresponsive whilst attempting to contact the listserver
Post by: TurfIt 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.
Title: Re: Game unresponsive whilst attempting to contact the listserver
Post by: prissi 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.
Title: Re: Game unresponsive whilst attempting to contact the listserver
Post by: Ters 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.
Title: Re: Game unresponsive whilst attempting to contact the listserver
Post by: prissi 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.