Core/DBLayer: Implement async transaction completion callbacks

Port From (https://github.com/TrinityCore/TrinityCore/commit/0f0ca3a9194d76afa0227943e86469ad8368c5e2)
This commit is contained in:
hondacrx
2020-04-26 00:53:43 -04:00
parent a9d1d3f2b0
commit d450f6db3d
14 changed files with 224 additions and 109 deletions
+6 -6
View File
@@ -65,7 +65,7 @@ namespace Game.Network
stmt.AddValue(0, ip_address);
stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpAddress().GetAddressBytes(), 0));
_queryProcessor.AddQuery(DB.Login.AsyncQuery(stmt).WithCallback(CheckIpCallback));
_queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(CheckIpCallback));
}
void CheckIpCallback(SQLResult result)
@@ -356,7 +356,7 @@ namespace Game.Network
if (!base.Update())
return false;
_queryProcessor.ProcessReadyQueries();
_queryProcessor.ProcessReadyCallbacks();
return true;
}
@@ -378,7 +378,7 @@ namespace Game.Network
stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Realm);
stmt.AddValue(1, authSession.RealmJoinTicket);
_queryProcessor.AddQuery(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthSessionCallback, authSession));
_queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthSessionCallback, authSession));
}
void HandleAuthSessionCallback(AuthSession authSession, SQLResult result)
@@ -559,7 +559,7 @@ namespace Game.Network
//if (wardenActive)
//_worldSession.InitWarden(_sessionKey);
_queryProcessor.AddQuery(_worldSession.LoadPermissionsAsync().WithCallback(LoadSessionPermissionsCallback));
_queryProcessor.AddCallback(_worldSession.LoadPermissionsAsync().WithCallback(LoadSessionPermissionsCallback));
}
void LoadSessionPermissionsCallback(SQLResult result)
@@ -587,7 +587,7 @@ namespace Game.Network
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_CONTINUED_SESSION);
stmt.AddValue(0, accountId);
_queryProcessor.AddQuery(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthContinuedSessionCallback, authSession));
_queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthContinuedSessionCallback, authSession));
}
void HandleAuthContinuedSessionCallback(AuthContinuedSession authSession, SQLResult result)
@@ -745,7 +745,7 @@ namespace Game.Network
ZLib.z_stream _compressionStream;
QueryCallbackProcessor _queryProcessor = new QueryCallbackProcessor();
AsyncCallbackProcessor<QueryCallback> _queryProcessor = new AsyncCallbackProcessor<QueryCallback>();
string _ipCountry;
}