distraction action

This commit is contained in:
malloc 2018-04-23 09:21:58 -05:00
parent b62ea3ab0e
commit ed0feac5b5
6 changed files with 25 additions and 16 deletions

View file

@ -8,6 +8,7 @@ namespace sosc {
namespace cgc {
class Cipher {
public:
Cipher() {};
Cipher(const KeyExchange& key);
void Parse(std::string* data);

View file

@ -5,6 +5,9 @@
#include "../sock/scapesock.hpp"
#include "../sock/pool.hpp"
#include "../crypto/keyex.hpp"
#include "../crypto/cipher.hpp"
namespace sosc {
/** MASTER -> CLIENT **/
@ -12,12 +15,15 @@ class MasterClient {
public:
private:
ScapeConnection client;
ScapeConnection sock;
cgc::KeyExchange key;
cgc::Cipher cipher;
};
class MasterClientPool : public Pool<MasterClient> {
protected:
bool ProcessClient(MasterClient client) override;
bool ProcessClient(MasterClient& client) override;
};
/** MASTER -> SLAVE **/
@ -25,15 +31,20 @@ protected:
class MasterIntra {
public:
MasterIntra(IntraClient client);
bool Process();
void Close();
private:
IntraClient client;
IntraClient sock;
cgc::KeyExchange key;
cgc::Cipher cipher;
};
class MasterIntraPool : public Pool<MasterIntra> {
protected:
bool ProcessClient(MasterIntra client) override;
bool ProcessClient(MasterIntra& client) override {
return client.Process();
}
};
}

View file

@ -1,9 +1,9 @@
#include "master.hpp"
sosc::MasterIntra::MasterIntra(IntraClient client) {
this->client = client;
this->sock = client;
}
bool sosc::MasterIntraPool::ProcessClient(MasterIntra client) {
bool sosc::MasterIntra::Process() {
return true;
}

View file

@ -1,5 +1,2 @@
#include "slave.hpp"
bool sosc::SlavePool::ProcessClient(SlaveClient* client) {
return true;
}

View file

@ -7,12 +7,12 @@
namespace sosc {
class SlaveClient {
public:
SlaveClient(ScapeConnection client);
private:
ScapeConnection client;
ScapeConnection sock;
};
class SlavePool : public Pool<SlaveClient*> {
class SlaveClientPool : Pool<SlaveClient*> {
protected:
bool ProcessClient(SlaveClient* client) override;
};

View file

@ -42,7 +42,7 @@ public:
void Stop();
protected:
virtual bool ProcessClient(T client) = 0;
virtual bool ProcessClient(T& client) = 0;
private:
bool IsStackFull(int stackCount) const;
bool CanAddStack() const;
@ -239,7 +239,7 @@ void Pool<T>::Stack::Stop() {
return;
this->is_running = false;
this->thread.join();
this->thread->join();
delete this->thread;
this->is_open = false;