JN 11:35 - Jesus wept.
This commit is contained in:
parent
ceedfe12e2
commit
de7672f266
4 changed files with 12 additions and 12 deletions
|
@ -14,7 +14,6 @@ namespace sosc {
|
||||||
namespace db {
|
namespace db {
|
||||||
|
|
||||||
class Query;
|
class Query;
|
||||||
typedef std::vector<Query*> QueryList;
|
|
||||||
|
|
||||||
class ResultSet {
|
class ResultSet {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
||||||
class MasterIntra {
|
class MasterIntra {
|
||||||
public:
|
public:
|
||||||
explicit MasterIntra(const IntraClient& client);
|
explicit MasterIntra(const IntraClient& client);
|
||||||
bool Process(const db::QueryList* queries);
|
bool Process(const Pool::Queries* queries);
|
||||||
|
|
||||||
bool Close();
|
bool Close();
|
||||||
bool Close(const Packet& message);
|
bool Close(const Packet& message);
|
||||||
|
@ -75,20 +75,18 @@ private:
|
||||||
int32_t server_id;
|
int32_t server_id;
|
||||||
std::string license;
|
std::string license;
|
||||||
|
|
||||||
const db::QueryList* queries;
|
const Pool::Queries* queries;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MasterIntraPool : public Pool<MasterIntra> {
|
class MasterIntraPool : public Pool<MasterIntra> {
|
||||||
public:
|
public:
|
||||||
MasterIntraPool();
|
MasterIntraPool();
|
||||||
protected:
|
protected:
|
||||||
bool ProcessClient(MasterIntra& client) override {
|
bool ProcessClient(MasterIntra& client, const Queries* queries) override {
|
||||||
return client.Process(&this->queries);
|
return client.Process(queries);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop() override;
|
void Stop() override;
|
||||||
private:
|
|
||||||
db::QueryList queries;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ bool sosc::MasterIntra::Authentication(sosc::Packet& pck) {
|
||||||
if(!pck.Check(4, PCK_ANY, 2, PCK_ANY, 512))
|
if(!pck.Check(4, PCK_ANY, 2, PCK_ANY, 512))
|
||||||
return this->Close();
|
return this->Close();
|
||||||
|
|
||||||
db::Query* query = this->queries->at(QRY_LICENSE_CHECK);
|
db::Query* query = &this->queries[QRY_LICENSE_CHECK];
|
||||||
query->Reset();
|
query->Reset();
|
||||||
query->BindText(pck[2], 0);
|
query->BindText(pck[2], 0);
|
||||||
query->BindBlob(pck[3], 1);
|
query->BindBlob(pck[3], 1);
|
||||||
|
|
|
@ -42,9 +42,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
|
|
||||||
|
typedef std::vector<db::Query> Queries;
|
||||||
protected:
|
protected:
|
||||||
virtual void SetupQueries(std::vector<db::Query>* queries) {};
|
virtual void SetupQueries(Queries* queries) {};
|
||||||
virtual bool ProcessClient(T& client, std::vector<db::Query>* queries) = 0;
|
virtual bool ProcessClient(T& client, Queries* queries) = 0;
|
||||||
private:
|
private:
|
||||||
bool IsStackFull(int stackCount) const;
|
bool IsStackFull(int stackCount) const;
|
||||||
bool CanAddStack() const;
|
bool CanAddStack() const;
|
||||||
|
@ -66,7 +68,7 @@ private:
|
||||||
private:
|
private:
|
||||||
void StackThread();
|
void StackThread();
|
||||||
|
|
||||||
std::vector<db::Query> queries;
|
Queries queries;
|
||||||
std::thread* thread;
|
std::thread* thread;
|
||||||
Pool<T>* pool;
|
Pool<T>* pool;
|
||||||
bool is_open;
|
bool is_open;
|
||||||
|
@ -79,7 +81,7 @@ private:
|
||||||
poolinfo_t info;
|
poolinfo_t info;
|
||||||
bool is_open;
|
bool is_open;
|
||||||
|
|
||||||
std::vector<db::Query> queries;
|
Queries queries;
|
||||||
std::vector<Stack*> stacks;
|
std::vector<Stack*> stacks;
|
||||||
|
|
||||||
friend class Stack;
|
friend class Stack;
|
||||||
|
@ -101,6 +103,7 @@ void Pool<T>::Start() {
|
||||||
if(this->is_open)
|
if(this->is_open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this->queries = std::vector<db::Query>();
|
||||||
this->SetupQueries(&this->queries);
|
this->SetupQueries(&this->queries);
|
||||||
for(int i = 0; i < this->info.initial_count; ++i) {
|
for(int i = 0; i < this->info.initial_count; ++i) {
|
||||||
this->stacks.push_back(new Stack(this));
|
this->stacks.push_back(new Stack(this));
|
||||||
|
|
Loading…
Reference in a new issue