if(mysql_ping(mConnectionHandle) == -1)
mysql_ping has been removed a long time ago. You do not need to check if the connection is dead so you can reconnect it, there is a parameter (autoreconnect) in mysql_connect which is set to true by default and it will do it for you..
|
Also update to R39-3 |
for(new connectionCount; connectionCount < MYSQL_CONNECTION_TRIES; connectionCount++)
{
mConnectionHandle = mysql_connect(SQLHost, SQLUser, SQLDatabase, SQLPassword);
if(connectionCount == MYSQL_CONNECTION_TRIES - 1)
{
printf("The server has failed to connect to MySQL the maximum amount of times, shutting down...");
SendRconCommand("exit");
return 1;
}
else
{
printf("Failed to connect to MySQL, retrying...");
}
else
{
printf("The server has successfully connected to MySQL!");
mysql_log(SQLDebug);
break;
}
}
new connectionCount = 1;
do
{
printf("connecting, attempt %d / %d", connectionCount, MYSQL_CONNECTION_TRIES);
mConnectionHandle = mysql_connect(...);
}
while(!mConnectionHandle && connectionCount++ < MYSQL_CONNECTION_TRIES);
if(!mConnectionHandle)
{
// failed to connect shiz
return 0;
}
// rest of gamemodeinit