aboutsummaryrefslogtreecommitdiff
path: root/src/query.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-08-15 15:48:19 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-08-15 15:50:32 -0300
commit8082c228c5d618e6f865f76b4d0518c2fde573ec (patch)
tree59e61abe98c3060fb1eb3677b9dbbb744c92174a /src/query.cc
parente4b8bf807b76f6f446d9617d9a3957dc77dd6e90 (diff)
downloadgame-8082c228c5d618e6f865f76b4d0518c2fde573ec.tar.gz
game-8082c228c5d618e6f865f76b4d0518c2fde573ec.zip
wrapping up for a public release
Diffstat (limited to 'src/query.cc')
-rw-r--r--src/query.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/query.cc b/src/query.cc
index c9b47aa..3b62ecd 100644
--- a/src/query.cc
+++ b/src/query.cc
@@ -312,7 +312,8 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
return QUERY_STATUS_FAILED;
}
- for(int Attempt = 0; true; Attempt += 1){
+ const int MaxAttempts = 2;
+ for(int Attempt = 1; true; Attempt += 1){
if(!this->isConnected()){
if(!AutoReconnect){
return QUERY_STATUS_FAILED;
@@ -335,7 +336,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
if(this->write(this->Buffer, PacketSize) != PacketSize){
this->disconnect();
- if(Attempt > 0){
+ if(Attempt >= MaxAttempts){
error("TQueryManagerConnection::executeQuery: Fehler beim Abschicken der Anfrage.\n");
return QUERY_STATUS_FAILED;
}
@@ -346,7 +347,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
int BytesRead = this->read(Help, 2, Timeout);
if(BytesRead != 2){
this->disconnect();
- if(BytesRead == -2 || Attempt > 0){
+ if(BytesRead == -2 || Attempt >= MaxAttempts){
return QUERY_STATUS_FAILED;
}
continue;