Page 5 of 12
Re: Dedicated Server API Client Communication
Posted: 20 Apr 2014, 16:11
by steeffeen
hey there
we encountered an issue in the Request class
the following adjusted test code fails
Code: Select all
$v = array('test' => true);
if(array_keys($v) == range(0, count($v) - 1)) {
echo 'fail';
} else {
echo 'k';
}
it's used to distinguish between array and struct
now an associative array (struct) with only 1 member gets interpreted as an array for some reason
so for example SetScriptModeSettings fails if you only set 1 settings as the dedicated expects a struct but gets an array
any idea?
Re: Dedicated Server API Client Communication
Posted: 20 Apr 2014, 16:18
by steeffeen
well the problem is that the following code succeeds...
Code: Select all
if (array('test') == array(0)) echo 'hell no';
even though the arrays are obviously different
Re: Dedicated Server API Client Communication
Posted: 20 Apr 2014, 16:27
by The_Big_Boo
Oops, should be a strict equality, so === instead of ==. Fixed!
Re: Dedicated Server API Client Communication
Posted: 20 Apr 2014, 16:36
by steeffeen
thanks. still weird that == doesn't work as it's supposed to check for key-value pairs, not?
//Edit: nevermind ('test' == 0) is true... i thought only empty string equals zero
Re: Dedicated Server API Client Communication
Posted: 20 Apr 2014, 19:27
by The_Big_Boo
steeffeen wrote:thanks. still weird that == doesn't work as it's supposed to check for key-value pairs, not?
PHP documentation is sometimes incomplete thus misleading. In my case, I was actually thinking it would convert everything to strings as in some array functions...
@kresmy: do you know when the broken pipe on fwrite happened? Because it clearly means the connection is closed, not that the dedicated is simply hanging... Anyway, the notice will be silenced, so the custom exception is sent instead.
Also, can you also give some basic info about configurations (OSes and if the server controller is running on the same machine than the dedicated or not).
Re: Dedicated Server API Client Communication
Posted: 23 Apr 2014, 16:54
by The_Big_Boo
If the dedicated is somehow hanging while changing map, then I don't really know what can be done except increasing timeouts... Can you try to have a more informative context than the exception itself to see it indeed happens only during map change?
There's still a really strange case, the one where it timed out while reading callbacks. It's quite unexpected as it means stream_select said there was something to read but then it can't even read the first 8 bytes header.
Anyway, I can't do miracles on this kind of issues

. The original goal was to have a cleaner code without adding bugs, and I think this has been achieved. There are also new methods to help using the library, and the encoding/decoding is faster. So if in the end it appears long timeouts are needed, then let's put them back to 5s as they were before, especially if it happens only during map change.