by chance shalt thine eyes be set upon these sacred texts thou shalt surely perish by the sword

This commit is contained in:
malloc 2018-10-15 16:31:54 -05:00
parent ab05977fe6
commit 5929a397cc
6 changed files with 17 additions and 17 deletions

View file

@ -14,6 +14,7 @@ namespace sosc {
namespace db {
class Query;
typedef std::vector<db::Query*> Queries;
class ResultSet {
public:

View file

@ -18,7 +18,7 @@ namespace sosc {
class MasterClient {
public:
explicit MasterClient(const ScapeConnection& client);
bool Process(const Queries* queries);
bool Process(const db::Queries* queries);
bool Close();
bool Close(const Packet& message);
@ -40,11 +40,11 @@ private:
class MasterClientPool : public Pool<MasterClient, ctx::MasterClientContext> {
protected:
void SetupQueries(Queries* queries) override;
void SetupQueries(db::Queries* queries) override;
bool ProcessClient(
MasterClient& client,
ctx::MasterClientContext* context,
const Queries* queries) override
const db::Queries* queries) override
{
return client.Process(queries);
}
@ -55,7 +55,7 @@ protected:
class MasterIntra {
public:
explicit MasterIntra(const IntraClient& client);
bool Process(const Queries* queries);
bool Process(const db::Queries* queries);
bool Close();
bool Close(const Packet& message);
@ -87,16 +87,16 @@ private:
int32_t server_id;
std::string license;
const Queries* queries;
const db::Queries* queries;
};
class MasterIntraPool : public Pool<MasterIntra, ctx::MasterIntraContext> {
protected:
void SetupQueries(Queries* queries) override;
void SetupQueries(db::Queries* queries) override;
bool ProcessClient
(MasterIntra& client,
ctx::MasterIntraContext* context,
const Queries* queries) override
const db::Queries* queries) override
{
return client.Process(queries);
}

View file

@ -6,7 +6,7 @@ static struct {
/** MASTERCLIENTPOOL CODE **/
void sosc::MasterClientPool::SetupQueries(Queries *queries) {
void sosc::MasterClientPool::SetupQueries(db::Queries *queries) {
#define QRY_USER_REG_CHECK 0
queries->push_back(new db::Query(
"SELECT COUNT(*) FROM `USERS` "
@ -53,6 +53,6 @@ sosc::MasterClient::MasterClient(const ScapeConnection &client) {
this->auth_attempts = 0;
}
bool sosc::MasterClient::Process(const Queries *queries) {
bool sosc::MasterClient::Process(const db::Queries *queries) {
}

View file

@ -6,7 +6,7 @@ static struct {
/** MASTERINTRAPOOL CODE **/
void sosc::MasterIntraPool::SetupQueries(Queries* queries) {
void sosc::MasterIntraPool::SetupQueries(db::Queries* queries) {
#define QRY_LICENSE_CHECK 0
queries->push_back(new db::Query(
"SELECT COUNT(*) FROM `SERVER_LICENSES` "
@ -81,7 +81,7 @@ sosc::MasterIntra::MasterIntra(const IntraClient& client) {
this->auth_attempts = 0;
}
bool sosc::MasterIntra::Process(const Queries* queries) {
bool sosc::MasterIntra::Process(const db::Queries* queries) {
Packet pck;
int status = this->sock.Receive(&pck);
if(status == PCK_ERR)

View file

@ -20,7 +20,7 @@ protected:
bool ProcessClient
(SlaveClient& client,
ctx::SlaveContext* context,
const Queries* queries) override
const db::Queries* queries) override
{
// TODO implement
return true;

View file

@ -8,7 +8,6 @@
#include "db/database.hpp"
namespace sosc {
typedef std::vector<db::Query*> Queries;
typedef struct {
// amount of threads to start with (never close)
@ -45,9 +44,9 @@ public:
virtual void Stop();
protected:
virtual void SetupQueries(Queries* queries) {};
virtual void SetupQueries(db::Queries* queries) {};
virtual bool ProcessClient
(T& client, U* context, const Queries* queries) = 0;
(T& client, U* context, const db::Queries* queries) = 0;
private:
bool IsStackFull(int stackCount) const;
bool CanAddStack() const;
@ -69,7 +68,7 @@ private:
private:
void StackThread();
Queries queries;
db::Queries queries;
std::thread* thread;
Pool<T,U>* pool;
bool is_open;
@ -83,7 +82,7 @@ private:
bool is_open;
U context;
Queries queries;
db::Queries queries;
std::vector<Stack*> stacks;
friend class Stack;