by chance shalt thine eyes be set upon these sacred texts thou shalt surely perish by the sword
This commit is contained in:
parent
ab05977fe6
commit
5929a397cc
6 changed files with 17 additions and 17 deletions
|
@ -14,6 +14,7 @@ namespace sosc {
|
||||||
namespace db {
|
namespace db {
|
||||||
|
|
||||||
class Query;
|
class Query;
|
||||||
|
typedef std::vector<db::Query*> Queries;
|
||||||
|
|
||||||
class ResultSet {
|
class ResultSet {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace sosc {
|
||||||
class MasterClient {
|
class MasterClient {
|
||||||
public:
|
public:
|
||||||
explicit MasterClient(const ScapeConnection& client);
|
explicit MasterClient(const ScapeConnection& client);
|
||||||
bool Process(const Queries* queries);
|
bool Process(const db::Queries* queries);
|
||||||
|
|
||||||
bool Close();
|
bool Close();
|
||||||
bool Close(const Packet& message);
|
bool Close(const Packet& message);
|
||||||
|
@ -40,11 +40,11 @@ private:
|
||||||
|
|
||||||
class MasterClientPool : public Pool<MasterClient, ctx::MasterClientContext> {
|
class MasterClientPool : public Pool<MasterClient, ctx::MasterClientContext> {
|
||||||
protected:
|
protected:
|
||||||
void SetupQueries(Queries* queries) override;
|
void SetupQueries(db::Queries* queries) override;
|
||||||
bool ProcessClient(
|
bool ProcessClient(
|
||||||
MasterClient& client,
|
MasterClient& client,
|
||||||
ctx::MasterClientContext* context,
|
ctx::MasterClientContext* context,
|
||||||
const Queries* queries) override
|
const db::Queries* queries) override
|
||||||
{
|
{
|
||||||
return client.Process(queries);
|
return client.Process(queries);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ protected:
|
||||||
class MasterIntra {
|
class MasterIntra {
|
||||||
public:
|
public:
|
||||||
explicit MasterIntra(const IntraClient& client);
|
explicit MasterIntra(const IntraClient& client);
|
||||||
bool Process(const Queries* queries);
|
bool Process(const db::Queries* queries);
|
||||||
|
|
||||||
bool Close();
|
bool Close();
|
||||||
bool Close(const Packet& message);
|
bool Close(const Packet& message);
|
||||||
|
@ -87,16 +87,16 @@ private:
|
||||||
int32_t server_id;
|
int32_t server_id;
|
||||||
std::string license;
|
std::string license;
|
||||||
|
|
||||||
const Queries* queries;
|
const db::Queries* queries;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MasterIntraPool : public Pool<MasterIntra, ctx::MasterIntraContext> {
|
class MasterIntraPool : public Pool<MasterIntra, ctx::MasterIntraContext> {
|
||||||
protected:
|
protected:
|
||||||
void SetupQueries(Queries* queries) override;
|
void SetupQueries(db::Queries* queries) override;
|
||||||
bool ProcessClient
|
bool ProcessClient
|
||||||
(MasterIntra& client,
|
(MasterIntra& client,
|
||||||
ctx::MasterIntraContext* context,
|
ctx::MasterIntraContext* context,
|
||||||
const Queries* queries) override
|
const db::Queries* queries) override
|
||||||
{
|
{
|
||||||
return client.Process(queries);
|
return client.Process(queries);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ static struct {
|
||||||
|
|
||||||
/** MASTERCLIENTPOOL CODE **/
|
/** MASTERCLIENTPOOL CODE **/
|
||||||
|
|
||||||
void sosc::MasterClientPool::SetupQueries(Queries *queries) {
|
void sosc::MasterClientPool::SetupQueries(db::Queries *queries) {
|
||||||
#define QRY_USER_REG_CHECK 0
|
#define QRY_USER_REG_CHECK 0
|
||||||
queries->push_back(new db::Query(
|
queries->push_back(new db::Query(
|
||||||
"SELECT COUNT(*) FROM `USERS` "
|
"SELECT COUNT(*) FROM `USERS` "
|
||||||
|
@ -53,6 +53,6 @@ sosc::MasterClient::MasterClient(const ScapeConnection &client) {
|
||||||
this->auth_attempts = 0;
|
this->auth_attempts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sosc::MasterClient::Process(const Queries *queries) {
|
bool sosc::MasterClient::Process(const db::Queries *queries) {
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ static struct {
|
||||||
|
|
||||||
/** MASTERINTRAPOOL CODE **/
|
/** MASTERINTRAPOOL CODE **/
|
||||||
|
|
||||||
void sosc::MasterIntraPool::SetupQueries(Queries* queries) {
|
void sosc::MasterIntraPool::SetupQueries(db::Queries* queries) {
|
||||||
#define QRY_LICENSE_CHECK 0
|
#define QRY_LICENSE_CHECK 0
|
||||||
queries->push_back(new db::Query(
|
queries->push_back(new db::Query(
|
||||||
"SELECT COUNT(*) FROM `SERVER_LICENSES` "
|
"SELECT COUNT(*) FROM `SERVER_LICENSES` "
|
||||||
|
@ -81,7 +81,7 @@ sosc::MasterIntra::MasterIntra(const IntraClient& client) {
|
||||||
this->auth_attempts = 0;
|
this->auth_attempts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sosc::MasterIntra::Process(const Queries* queries) {
|
bool sosc::MasterIntra::Process(const db::Queries* queries) {
|
||||||
Packet pck;
|
Packet pck;
|
||||||
int status = this->sock.Receive(&pck);
|
int status = this->sock.Receive(&pck);
|
||||||
if(status == PCK_ERR)
|
if(status == PCK_ERR)
|
||||||
|
|
|
@ -20,7 +20,7 @@ protected:
|
||||||
bool ProcessClient
|
bool ProcessClient
|
||||||
(SlaveClient& client,
|
(SlaveClient& client,
|
||||||
ctx::SlaveContext* context,
|
ctx::SlaveContext* context,
|
||||||
const Queries* queries) override
|
const db::Queries* queries) override
|
||||||
{
|
{
|
||||||
// TODO implement
|
// TODO implement
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "db/database.hpp"
|
#include "db/database.hpp"
|
||||||
|
|
||||||
namespace sosc {
|
namespace sosc {
|
||||||
typedef std::vector<db::Query*> Queries;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// amount of threads to start with (never close)
|
// amount of threads to start with (never close)
|
||||||
|
@ -45,9 +44,9 @@ public:
|
||||||
|
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
protected:
|
protected:
|
||||||
virtual void SetupQueries(Queries* queries) {};
|
virtual void SetupQueries(db::Queries* queries) {};
|
||||||
virtual bool ProcessClient
|
virtual bool ProcessClient
|
||||||
(T& client, U* context, const Queries* queries) = 0;
|
(T& client, U* context, const db::Queries* queries) = 0;
|
||||||
private:
|
private:
|
||||||
bool IsStackFull(int stackCount) const;
|
bool IsStackFull(int stackCount) const;
|
||||||
bool CanAddStack() const;
|
bool CanAddStack() const;
|
||||||
|
@ -69,7 +68,7 @@ private:
|
||||||
private:
|
private:
|
||||||
void StackThread();
|
void StackThread();
|
||||||
|
|
||||||
Queries queries;
|
db::Queries queries;
|
||||||
std::thread* thread;
|
std::thread* thread;
|
||||||
Pool<T,U>* pool;
|
Pool<T,U>* pool;
|
||||||
bool is_open;
|
bool is_open;
|
||||||
|
@ -83,7 +82,7 @@ private:
|
||||||
bool is_open;
|
bool is_open;
|
||||||
|
|
||||||
U context;
|
U context;
|
||||||
Queries queries;
|
db::Queries queries;
|
||||||
std::vector<Stack*> stacks;
|
std::vector<Stack*> stacks;
|
||||||
|
|
||||||
friend class Stack;
|
friend class Stack;
|
||||||
|
|
Loading…
Reference in a new issue