rcon: don't expect two packets for authentication
This commit is contained in:
-15
@@ -176,21 +176,6 @@ int rcon_authenticate(int sockfd, const char *password) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: why do we expect two packets in response to a single auth request?
|
||||
// if this is the correct behaviour, please document it or else remove it.
|
||||
// Try to read second packet (may timeout, which is OK)
|
||||
rcon_packet_t response2;
|
||||
int result = recv_packet(sockfd, &response2);
|
||||
if (result == 0) {
|
||||
printf("received second auth packet: id=%d, type=%d\n", response2.id, response2.type);
|
||||
if (response2.type != RCON_SERVERDATA_AUTH_RESPONSE) {
|
||||
fprintf(stderr, "authentication failed - unexpected second packet type: %d\n", response2.type);
|
||||
return -1;
|
||||
}
|
||||
} else if (result == -2) {
|
||||
printf("no second packet (timeout - this is normal)\n");
|
||||
}
|
||||
|
||||
printf("authenticated successfully\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user