Made server a pointer for eliminating TCPSession2.
This commit is contained in:
1 parent
6c7fc7d28f
commit
a391882541
14 files changed
+336
-461
No files matched your search
+12
-6
@@ -4,10 +4,16 @@
|
||||
#include "TCPServer.h"
|
||||
#include "uuid/uuid.h"
|
||||
|
||||
namespace core
|
||||
{
|
||||
namespace core {
|
||||
|
||||
TCPSession::TCPSession(EPoll &ePoll, TCPServer &server, std::string text) : TCPSocket(ePoll, server.ctx, text), server(server) {
|
||||
TCPSession::TCPSession(EPoll &ePoll, std::string text) : TCPSocket(ePoll, text) {
|
||||
uuid_t uuidObject;
|
||||
uuid_generate(uuidObject);
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << uuidObject;
|
||||
alias = (void *)uuidObject;
|
||||
}
|
||||
|
||||
TCPSession::TCPSession(EPoll &ePoll, TCPServer *server, std::string text) : TCPSocket(ePoll, server->ctx, text), server(server) {
|
||||
uuid_t uuidObject;
|
||||
uuid_generate(uuidObject);
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << uuidObject;
|
||||
@@ -15,8 +21,8 @@ namespace core
|
||||
}
|
||||
|
||||
TCPSession::~TCPSession() {
|
||||
server.removeFromSessionList(this);
|
||||
server.subscriptions.removeSessionSubscriptions(*this);
|
||||
server->removeFromSessionList(this);
|
||||
server->subscriptions.removeSessionSubscriptions(*this);
|
||||
}
|
||||
|
||||
void TCPSession::output(std::stringstream &data) {
|
||||
@@ -25,7 +31,7 @@ namespace core
|
||||
|
||||
void TCPSession::protocol(coreutils::ZString &data) {
|
||||
if (data.getLength() != 0) {
|
||||
if (!server.commands.processRequest(data, *this)) {
|
||||
if (!server->commands.processRequest(data, *this)) {
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << "Received data could not be parsed: " << data.str();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user