JN 11:35 - Jesus wept.

This commit is contained in:
malloc 2018-07-10 16:52:20 -05:00
parent ceedfe12e2
commit de7672f266
4 changed files with 12 additions and 12 deletions

View file

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

View file

@ -37,7 +37,7 @@ protected:
class MasterIntra {
public:
explicit MasterIntra(const IntraClient& client);
bool Process(const db::QueryList* queries);
bool Process(const Pool::Queries* queries);
bool Close();
bool Close(const Packet& message);
@ -75,20 +75,18 @@ private:
int32_t server_id;
std::string license;
const db::QueryList* queries;
const Pool::Queries* queries;
};
class MasterIntraPool : public Pool<MasterIntra> {
public:
MasterIntraPool();
protected:
bool ProcessClient(MasterIntra& client) override {
return client.Process(&this->queries);
bool ProcessClient(MasterIntra& client, const Queries* queries) override {
return client.Process(queries);
}
void Stop() override;
private:
db::QueryList queries;
};
}

View file

@ -136,7 +136,7 @@ bool sosc::MasterIntra::Authentication(sosc::Packet& pck) {
if(!pck.Check(4, PCK_ANY, 2, PCK_ANY, 512))
return this->Close();
db::Query* query = this->queries->at(QRY_LICENSE_CHECK);
db::Query* query = &this->queries[QRY_LICENSE_CHECK];
query->Reset();
query->BindText(pck[2], 0);
query->BindBlob(pck[3], 1);

View file

@ -42,9 +42,11 @@ public:
}
virtual void Stop();
typedef std::vector<db::Query> Queries;
protected:
virtual void SetupQueries(std::vector<db::Query>* queries) {};
virtual bool ProcessClient(T& client, std::vector<db::Query>* queries) = 0;
virtual void SetupQueries(Queries* queries) {};
virtual bool ProcessClient(T& client, Queries* queries) = 0;
private:
bool IsStackFull(int stackCount) const;
bool CanAddStack() const;
@ -66,7 +68,7 @@ private:
private:
void StackThread();
std::vector<db::Query> queries;
Queries queries;
std::thread* thread;
Pool<T>* pool;
bool is_open;
@ -79,7 +81,7 @@ private:
poolinfo_t info;
bool is_open;
std::vector<db::Query> queries;
Queries queries;
std::vector<Stack*> stacks;
friend class Stack;
@ -101,6 +103,7 @@ void Pool<T>::Start() {
if(this->is_open)
return;
this->queries = std::vector<db::Query>();
this->SetupQueries(&this->queries);
for(int i = 0; i < this->info.initial_count; ++i) {
this->stacks.push_back(new Stack(this));