summaryrefslogtreecommitdiffstats
path: root/src/Server.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-23 01:34:43 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-05 14:16:52 +0200
commit1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b (patch)
treeea7f02576728ac4143707b0af3829ae843bde041 /src/Server.h
parentRename AddEntityIfNotPresent to AddPlayer (diff)
downloadcuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar.gz
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar.bz2
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar.lz
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar.xz
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.tar.zst
cuberite-1bc12ba2b3bc2c4fbe8fad4797cf33266eb13f4b.zip
Diffstat (limited to 'src/Server.h')
-rw-r--r--src/Server.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Server.h b/src/Server.h
index 208955237..5ac7fc998 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -100,8 +100,10 @@ public:
bool Command(cClientHandle & a_Client, AString & a_Cmd);
- /** Executes the console command, sends output through the specified callback */
- void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
+ /** Queues a console command for execution through the cServer class.
+ The command will be executed in the server tick thread.
+ The command's output will be written to the a_Output callback. */
+ void QueueExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
/** Lists all available console commands and their helpstrings */
void PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output);
@@ -201,12 +203,13 @@ private:
/** Number of players currently playing in the server. */
std::atomic_size_t m_PlayerCount;
+ cCriticalSection m_CSPendingCommands;
+ std::vector<std::pair<AString, cCommandOutputCallback *>> m_PendingCommands;
+
int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini
bool m_bIsConnected; // true - connected false - not connected
- std::atomic<bool> m_bRestarting;
-
/** The private key used for the assymetric encryption start in the protocols */
cRsaPrivateKey m_PrivateKey;
@@ -229,7 +232,6 @@ private:
bool m_bAllowMultiLogin;
cTickThread m_TickThread;
- cEvent m_RestartEvent;
/** The server ID used for client authentication */
AString m_ServerID;
@@ -264,6 +266,9 @@ private:
cServer(void);
+ /** Executes the console command, sends output through the specified callback. */
+ void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output);
+
/** Get the Forge mods registered for a given protocol, for modification */
AStringMap & RegisteredForgeMods(const UInt32 a_Protocol);
@@ -274,10 +279,14 @@ private:
Returns the cClientHandle reinterpreted as cTCPLink callbacks. */
cTCPLink::cCallbacksPtr OnConnectionAccepted(const AString & a_RemoteIPAddress);
- bool Tick(float a_Dt);
+ void Tick(float a_Dt);
/** Ticks the clients in m_Clients, manages the list in respect to removing clients */
void TickClients(float a_Dt);
+
+ /** Executes commands queued in the command queue. */
+ void TickCommands(void);
+
}; // tolua_export