summaryrefslogtreecommitdiffstats
path: root/source/Server.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-04 22:13:08 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-04 22:13:08 +0100
commit28d8d8419a5b900e9d20ce91dc63e28349b6470a (patch)
treebf5b7bafa902a138339c78877ecec376c055b727 /source/Server.h
parentRemoved the unused cHeartbeat object (diff)
downloadcuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.gz
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.bz2
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.lz
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.xz
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.tar.zst
cuberite-28d8d8419a5b900e9d20ce91dc63e28349b6470a.zip
Diffstat (limited to '')
-rw-r--r--source/Server.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/Server.h b/source/Server.h
index 707f91261..ec91bb6c0 100644
--- a/source/Server.h
+++ b/source/Server.h
@@ -14,6 +14,7 @@
#include "OSSupport/SocketThreads.h"
#include "CryptoPP/rsa.h"
#include "CryptoPP/randpool.h"
+#include "ListenThread.h"
@@ -30,19 +31,18 @@ typedef std::list<cClientHandle *> cClientHandleList;
class cServer // tolua_export
+ : public cListenThread::cCallback
{ // tolua_export
public: // tolua_export
bool InitServer(cIniFile & a_SettingsIni);
- int GetPort() { return m_iServerPort; }
- bool IsConnected(){return m_bIsConnected;} // returns connection status
- void StartListenClient(); // Listen to client
-
+ bool IsConnected(void) const { return m_bIsConnected;} // returns connection status
+
void BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude = NULL); // tolua_export
bool Tick(float a_Dt);
- void StartListenThread();
+ bool Start(void);
bool Command(cClientHandle & a_Client, const AString & a_Cmd);
void ExecuteConsoleCommand(const AString & a_Cmd);
@@ -57,8 +57,6 @@ public: // tolua_export
void KickUser(int a_ClientID, const AString & a_Reason);
void AuthenticateUser(int a_ClientID); // Called by cAuthenticator to auth the specified user
- static void ServerListenThread( void* a_Args );
-
const AString & GetServerID(void) const;
void ClientDestroying(const cClientHandle * a_Client); // Called by cClientHandle::Destroy(); stop m_SocketThreads from calling back into a_Client
@@ -106,6 +104,7 @@ private:
sServerState* m_pState;
cNotifyWriteThread m_NotifyWriteThread;
+ cListenThread m_ListenThread;
cCriticalSection m_CSClients; // Locks client list
cClientHandleList m_Clients; // Clients that are connected to the server
@@ -126,11 +125,14 @@ private:
CryptoPP::RSA::PrivateKey m_PrivateKey;
CryptoPP::RSA::PublicKey m_PublicKey;
- cServer();
+ cServer(void);
~cServer();
/// Loads, or generates, if missing, RSA keys for protocol encryption
void PrepareKeys(void);
+
+ // cListenThread::cCallback overrides:
+ virtual void OnConnectionAccepted(cSocket & a_Socket) override;
}; // tolua_export