Permalink
Browse files

Fix query combiner bug resulting in lost write queries.

- This was the cause of the issue that resulted in some servers not
  being marked as offline expectedly.  If the query combiner ran
  out of space, buffered queries were lost due to the wrong query
  variable being executed.
  • Loading branch information...
1 parent 6406ec6 commit 5efe7ad814f13ba869f772cca06bb222879d44e9 @SkywingvL committed Feb 3, 2013
Showing with 13 additions and 4 deletions.
  1. +12 −3 NWNMasterServer/NWGameServer.cs
  2. +1 −1 NWNMasterServer/NWMasterServer.cs
@@ -49,10 +49,11 @@ public NWGameServer(NWMasterServer MasterServer, IPEndPoint ServerAddress)
/// Save the server to the database. The server is assumed to be
/// locked.
/// </summary>
- public void Save()
+ /// <returns>True if the save was successful.</returns>
+ public bool Save()
{
if (MasterServer.ConnectionString == null)
- return;
+ return false;
try
{
@@ -187,7 +188,10 @@ public void Save()
Logger.Log(LogLevel.Error, "NWGameServer.Save(): Failed to save server {0}: Exception: {1}",
ServerAddress,
e);
+ return false;
}
+
+ return true;
}
/// <summary>
@@ -712,7 +716,12 @@ private void HeartbeatTimer_Elapsed(object sender, ElapsedEventArgs e)
ActivePlayerCount = 0;
Online = false;
Expired = true;
- Save();
+
+ if (!Save())
+ {
+ Logger.Log(LogLevel.Error, "NWGameServer.HeartbeatTimer_Elapsed(): Server {0} could not be saved as expired.", this);
+ Expired = false;
+ }
}
}
@@ -261,7 +261,7 @@ public void ExecuteQueryNoReaderCombine(string Query)
QueryCombineTimer.Start();
if (DirectQuery != null)
- MySqlHelper.ExecuteNonQuery(ConnectionString, Query);
+ MySqlHelper.ExecuteNonQuery(ConnectionString, DirectQuery);
}
catch (Exception e)
{

0 comments on commit 5efe7ad

Please sign in to comment.