feat(Core/Scripting): Pass IoContext to OnNetworkStart (#25501)
This commit is contained in:
parent
c83fc175a3
commit
4fd0c385da
4 changed files with 8 additions and 5 deletions
|
|
@ -15,13 +15,14 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ServerScript.h"
|
||||
#include "IoContext.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptMgrMacros.h"
|
||||
#include "ServerScript.h"
|
||||
|
||||
void ScriptMgr::OnNetworkStart()
|
||||
void ScriptMgr::OnNetworkStart(Acore::Asio::IoContext& ioContext)
|
||||
{
|
||||
CALL_ENABLED_HOOKS(ServerScript, SERVERHOOK_ON_NETWORK_START, script->OnNetworkStart());
|
||||
CALL_ENABLED_HOOKS(ServerScript, SERVERHOOK_ON_NETWORK_START, script->OnNetworkStart(ioContext));
|
||||
}
|
||||
|
||||
void ScriptMgr::OnNetworkStop()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#ifndef SCRIPT_OBJECT_SERVER_SCRIPT_H_
|
||||
#define SCRIPT_OBJECT_SERVER_SCRIPT_H_
|
||||
|
||||
#include "IoContext.h"
|
||||
#include "ScriptObject.h"
|
||||
#include <vector>
|
||||
#include <memory> // NOTE: this import is NEEDED (even though some IDEs report it as unused)
|
||||
|
|
@ -41,6 +42,7 @@ protected:
|
|||
public:
|
||||
// Called when reactive socket I/O is started (WorldSocketMgr).
|
||||
virtual void OnNetworkStart() { }
|
||||
virtual void OnNetworkStart(Acore::Asio::IoContext& /*ioContext*/) { OnNetworkStart(); }
|
||||
|
||||
// Called when reactive I/O is stopped.
|
||||
virtual void OnNetworkStop() { }
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public: /* SpellScriptLoader */
|
|||
void CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<SpellScriptLoader*, std::multimap<uint32, uint32>::iterator>>& scriptVector);
|
||||
|
||||
public: /* ServerScript */
|
||||
void OnNetworkStart();
|
||||
void OnNetworkStart(Acore::Asio::IoContext& ioContext);
|
||||
void OnNetworkStop();
|
||||
void OnSocketOpen(std::shared_ptr<WorldSocket> const& socket);
|
||||
void OnSocketClose(std::shared_ptr<WorldSocket> const& socket);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ bool WorldSocketMgr::StartWorldNetwork(Acore::Asio::IoContext& ioContext, std::s
|
|||
|
||||
_acceptor->AsyncAcceptWithCallback<&WorldSocketMgr::OnSocketAccept>();
|
||||
|
||||
sScriptMgr->OnNetworkStart();
|
||||
sScriptMgr->OnNetworkStart(ioContext);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue