Got it to compile.
This commit is contained in:
1 parent
d445834af6
commit
50bbfcc3c3
26 files changed
+271
-250
No files matched your search
+10
-17
@@ -1,5 +1,4 @@
|
||||
#include "TCPServer.h"
|
||||
#include "TCPService.h"
|
||||
#include "EPoll.h"
|
||||
#include "TCPSession.h"
|
||||
#include "Exception.h"
|
||||
@@ -16,7 +15,6 @@ namespace core {
|
||||
throw coreutils::Exception("Error on bind to socket: " + std::to_string(errno));
|
||||
if(listen(getDescriptor(), 20) < 0)
|
||||
throw coreutils::Exception("Error on listen to socket");
|
||||
service = getService(ePoll);
|
||||
}
|
||||
|
||||
TCPServer::~TCPServer() {
|
||||
@@ -60,10 +58,6 @@ namespace core {
|
||||
throw coreutils::Exception(errorString);
|
||||
}
|
||||
|
||||
TCPService * TCPServer::getService(EPoll &epoll) {
|
||||
return new TCPService(epoll);
|
||||
}
|
||||
|
||||
TCPSession * TCPServer::getSocketAccept(EPoll &ePoll) {
|
||||
return new TCPSession(ePoll, *this);
|
||||
}
|
||||
@@ -84,20 +78,19 @@ namespace core {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void TCPSession::sendToAll() {
|
||||
for(auto session : server.sessions)
|
||||
if(session != this)
|
||||
session->write(out.str());
|
||||
out.str("");
|
||||
void TCPServer::sendToAll(std::stringstream &data, TCPSession *sender) {
|
||||
for(auto session : sessions)
|
||||
if(session != sender)
|
||||
session->write(data.str());
|
||||
data.str("");
|
||||
}
|
||||
|
||||
void TCPSession::sendToAll(SessionFilter filter) {
|
||||
for(auto session : server.sessions)
|
||||
void TCPServer::sendToAll(std::stringstream &data, TCPSession *sender, SessionFilter &filter) {
|
||||
for(auto session : sessions)
|
||||
if(filter.test(*session))
|
||||
if(session != this)
|
||||
session->write(out.str());
|
||||
out.str("");
|
||||
if(session != sender)
|
||||
session->write(data.str());
|
||||
data.str("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user