add PIClientServer::Config, common configuration type for both sides, stream packer and encryption settings

This commit is contained in:
2024-09-13 11:08:32 +03:00
parent 996b7ea403
commit 17b902ebcc
8 changed files with 125 additions and 25 deletions

View File

@@ -110,11 +110,6 @@ void PIClientServer::Server::forEachClient(std::function<void(ServerClient *)> f
}
void PIClientServer::Server::enableSymmetricEncryption(const PIByteArray & key) {
crypt_key = key;
}
void PIClientServer::Server::stopServer() {
if (!tcp_server) return;
is_closing = true;
@@ -125,7 +120,7 @@ void PIClientServer::Server::stopServer() {
void PIClientServer::Server::newClient(ServerClient * c) {
clients << c;
c->enableSymmetricEncryption(crypt_key);
config.apply(c);
c->tcp->startThreadedRead();
c->connected();
piCout << "New client";