ServerCore/Service.cpp

30 lines
768 B
C++

#include "Service.h"
#include "TCPServerSocket.h"
#include "Exception.h"
namespace core {
Service::Service() {}
void Service::removeFromSessionList(Session *session) {
std::vector<Session *>::iterator cursor;
for(cursor = sessions.begin(); cursor < sessions.end(); ++cursor)
if(*cursor == session)
sessions.erase(cursor);
}
void Service::sessionErrorHandler(std::string errorString, Session *session) {
throw coreutils::Exception(errorString);
}
Session * Service::getSocketAccept(EPoll &ePoll) {
return new Session(ePoll, *this);
}
void Service::output(Session *session) {
session->out << "|" << session->ipAddress.getClientAddressAndPort();
}
}