Unity-Technologies / qstat

New official qstat repository
Artistic License 2.0
121 stars 33 forks source link

repair Teeworlds server support #3

Closed illwieckz closed 7 years ago

illwieckz commented 9 years ago

Teeworlds support is broken since many years. I have some experimental code on my computer but I faced a big problem:

Try send_tee_request_packet_1
If OK, deal_with_tee_packet
Else Try send_tee_request_packet_2
  If OK, deal_with_tee_packet
  Else Try send_tee_request_packet_3
  If OK, deal_with_tee_packet
stevenh commented 9 years ago

There's nothing to stop you using multiple queries with fall-back though them to ensure you get a response.

illwieckz commented 9 years ago

Yes, but I did not understand how to do that! :/

illwieckz commented 9 years ago

In tee.c I tried something like that:

int len_tee_statuspacket = 14;
int len_tee_statuspacke2 = 15;
int len_tee_statuspacke3 = 15;
char tee_statuspacket[14] = { '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', 'g', 'i', 'e', 'f' };
char tee_statuspacke2[15] = { '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', 'g', 'i', 'e', '2', '\x00' };
char tee_statuspacke3[15] = { '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', 'g', 'i', 'e', '3', '\x00' };

query_status_t send_tee_request_packet( struct qserver *server )
{
    query_status_t ret_packet;

    // Try first then second then third...

    ret_packet = send_packet( server, tee_statuspacket, len_tee_statuspacket );

    if (ret_packet < 0)
    {
        ret_packet = send_packet( server, tee_statuspacke2, len_tee_statuspacke2 );
    }

    if (ret_packet < 0)
    {
        ret_packet = send_packet( server, tee_statuspacke3, len_tee_statuspacke3 );
    }

    return ret_packet;
}

But it is certainly not the way to do it. I suppose it must be done elsewhere, in the function calling send_tee_request_packet for example.

stevenh commented 9 years ago

You could send all three packets like your doing then processes the return ensuring you pick the right decode.

illwieckz commented 9 years ago

OK, it needed only to do that:

- if (ret_packet < 0)
+ if (ret_packet == INPROGRESS)

:innocent:

illwieckz commented 9 years ago

You can try with

./qstat -tees 81.30.158.57:8299

or with:

./qstat -default tees -f /tmp/teelist.txt

where /tmp/teelist.cfg is http://pastebin.com/MALPwk7k