add encryption
This commit is contained in:
@@ -91,6 +91,11 @@ void PIClientServer::Server::setMaxClients(int new_max_clients) {
|
||||
}
|
||||
|
||||
|
||||
void PIClientServer::Server::enableSymmetricEncryption(const PIByteArray & key) {
|
||||
crypt_key = key;
|
||||
}
|
||||
|
||||
|
||||
void PIClientServer::Server::stopServer() {
|
||||
if (!tcp_server) return;
|
||||
tcp_server->stopAndWait();
|
||||
@@ -98,8 +103,9 @@ void PIClientServer::Server::stopServer() {
|
||||
|
||||
|
||||
void PIClientServer::Server::newClient(Client * c) {
|
||||
c->readed_func = [this, c](PIByteArray ba) { readed(c, ba); };
|
||||
clients << c;
|
||||
c->enableSymmetricEncryption(crypt_key);
|
||||
c->readed_func = [this, c](PIByteArray ba) { readed(c, ba); };
|
||||
c->tcp->startThreadedRead();
|
||||
c->connected();
|
||||
piCout << "New client";
|
||||
|
||||
Reference in New Issue
Block a user