- INotify/Thread epoll dispatch was silently dropping every live core::INotify event (an isKnownINotify registry fixes it) - this had broken mail delivery for over a week, masked by routine restarts. - TCPServer::lock self-deadlocked every admin-console connection via a plain std::mutex being re-entered; switched to recursive_mutex. - TLS.cpp/h: SNI-based certificate selection (addSNIContext), the groundwork for multi-tenant TLS (qualityiron.vegas alongside barant.com on one APIServer process). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
#include "ConsoleServer.h"
|
|
#include "ConsoleSession.h"
|
|
#include "Command.h"
|
|
#include "Log.h"
|
|
|
|
namespace core {
|
|
|
|
ConsoleServer::ConsoleServer(EPoll &ePoll, IPAddress address, TLSInfo *tlsInfo,
|
|
std::function<bool(std::string, std::string)> credentialChecker)
|
|
: TCPServer(ePoll, address, tlsInfo, " ", 10, "Console Server"), credentialChecker(credentialChecker) {
|
|
coreutils::Log(this);
|
|
}
|
|
|
|
void ConsoleServer::logSend(std::string out) {
|
|
// Was unlocked entirely (and iterated raw pointers before
|
|
// TCPServer::sessions became shared_ptr-owned - see its own doc
|
|
// comment) despite connectionRequest()/removeFromSessionList()
|
|
// both mutating this same vector under `lock` from other threads.
|
|
std::lock_guard guard(lock);
|
|
for(auto &session : sessions)
|
|
((ConsoleSession *)session.get())->writeLog(out);
|
|
}
|
|
|
|
TCPSession * ConsoleServer::getSocketAccept(EPoll &ePoll) {
|
|
return new ConsoleSession(ePoll, this);
|
|
}
|
|
|
|
bool ConsoleServer::checkCredentials(std::string user, std::string password) {
|
|
return credentialChecker ? credentialChecker(user, password) : true;
|
|
}
|
|
|
|
}
|