Rework for TLS.

This commit is contained in:
Brad Arant committed 2024-07-10 13:30:18 -07:00
1 parent 519faa535b
commit b7deabc5dc
2830 files changed
+4559 -80373

No files matched your search

+7 -14
View File
@@ -29,8 +29,7 @@ namespace core
throw coreutils::Exception("Error on listen to socket");
}
TCPServer::~TCPServer()
{
TCPServer::~TCPServer() {
coreutils::Log(coreutils::LOG_DEBUG_2) << "Closing server socket " << getDescriptor() << ".";
close(getDescriptor());
}
@@ -61,12 +60,10 @@ namespace core
// }
return session;
}
catch (coreutils::Exception e)
{
catch (coreutils::Exception e) {
coreutils::Log(coreutils::LOG_EXCEPT) << "Major error on session initialization. Error is '" << e.text << "'.";
}
catch (...)
{
catch (...) {
coreutils::Log(coreutils::LOG_EXCEPT) << "Unnspecified error on session initialization.";
}
return NULL;
@@ -106,23 +103,20 @@ namespace core
return 1;
}
void TCPServer::sendToAll(std::stringstream &data)
{
void TCPServer::sendToAll(std::stringstream &data) {
for (auto session : sessions)
session->write(data.str());
data.str("");
}
void TCPServer::sendToAll(std::stringstream &data, TCPSession &sender)
{
void TCPServer::sendToAll(std::stringstream &data, TCPSession &sender) {
for (auto session : sessions)
if (session != &sender)
session->write(data.str());
data.str("");
}
void TCPServer::sendToAll(std::stringstream &data, TCPSession &sender, SessionFilter filter)
{
void TCPServer::sendToAll(std::stringstream &data, TCPSession &sender, SessionFilter filter) {
for (auto session : sessions)
if (filter.test(*session))
if (session != &sender)
@@ -130,8 +124,7 @@ namespace core
data.str("");
}
TCPSession *TCPServer::getSessionByAlias(void *alias)
{
TCPSession *TCPServer::getSessionByAlias(void *alias) {
coreutils::Log(coreutils::LOG_DEBUG_1) << alias;
for (auto session : sessions)
if (session->compareAlias(alias))