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 { namespace cgc {
class Cipher { class Cipher {
public: public:
Cipher() {};
Cipher(const KeyExchange& key); Cipher(const KeyExchange& key);
void Parse(std::string* data); void Parse(std::string* data);

View file

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

View file

@ -1,9 +1,9 @@
#include "master.hpp" #include "master.hpp"
sosc::MasterIntra::MasterIntra(IntraClient client) { 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" #include "slave.hpp"
bool sosc::SlavePool::ProcessClient(SlaveClient* client) {
return true;
}

View file

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

View file

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