Major changes to socket scheduling in EPoll.

This commit is contained in:
barant committed 2020-02-29 19:27:58 -08:00
1 parent 790906a6dc
commit a5a51f8aae
512 files changed
+22663 -2121

No files matched your search

+22 -7
View File
@@ -5,7 +5,9 @@
#include "SessionFilter.h"
namespace core {
class Command;
class TCPServer;
///
@@ -22,8 +24,11 @@ namespace core {
public:
TCPSession(EPoll &ePoll, TCPServer &server);
TCPSession(EPoll &ePoll, TCPServer &server, std::string text);
~TCPSession();
Command *grab = NULL;
virtual void output(std::stringstream &data);
///
@@ -31,14 +36,14 @@ namespace core {
/// to the session containing the stream.
///
void send();
void send(std::string data);
///
/// Use this sendToAll method to output the contents of the out stream
/// to all the connections on the server excluding the sender session.
///
void sendToAll();
void sendToAll(std::string data);
///
/// Use this sendToAll method to output the contents of the out stream
@@ -46,9 +51,7 @@ namespace core {
/// and the entries identified by the passed in filter object.
///
void sendToAll(SessionFilter filter);
std::stringstream out;
void sendToAll(SessionFilter filter, std::string data);
TCPServer &server;
@@ -57,6 +60,14 @@ namespace core {
virtual void onDataReceived(std::string data) override;
virtual void onRegister() override;
///
/// This method is called from within the protocol method when protocol is called
/// on the initial connection where the data is an empty string. Use this method
/// to deliver a message to the connection upon connection.
///
virtual void onConnected(std::stringstream &out);
///
/// Override the protocol method to manage and control the session communications
/// in your inherited session. If you do not override this method then the Session
@@ -64,7 +75,11 @@ namespace core {
/// processRequest method on the session input.
///
virtual void protocol(std::string data);
virtual void protocol(std::stringstream &out, std::string data);
private:
std::mutex mtx;
};