Major changes to socket scheduling in EPoll.
This commit is contained in:
1 parent
790906a6dc
commit
a5a51f8aae
512 files changed
+22663
-2121
No files matched your search
+15
-18
@@ -9,7 +9,7 @@ namespace core {
|
||||
|
||||
ConsoleSession::~ConsoleSession() {}
|
||||
|
||||
void ConsoleSession::protocol(std::string data = "") {
|
||||
void ConsoleSession::protocol(std::stringstream &out, std::string data = "") {
|
||||
|
||||
switch (status) {
|
||||
|
||||
@@ -23,25 +23,23 @@ namespace core {
|
||||
setCursorLocation(2, 1);
|
||||
setBackColor(BG_BLACK);
|
||||
status = LOGIN;
|
||||
protocol();
|
||||
protocol(out);
|
||||
break;
|
||||
|
||||
case LOGIN:
|
||||
setCursorLocation(3, 3);
|
||||
out << "Enter User Profile: ";
|
||||
send();
|
||||
status = WAIT_USER_PROFILE;
|
||||
break;
|
||||
|
||||
case WAIT_USER_PROFILE:
|
||||
status = PASSWORD;
|
||||
protocol();
|
||||
protocol(out);
|
||||
break;
|
||||
|
||||
case PASSWORD:
|
||||
setCursorLocation(4, 7);
|
||||
out << "Enter Password: ";
|
||||
send();
|
||||
status = WAIT_PASSWORD;
|
||||
break;
|
||||
|
||||
@@ -56,14 +54,13 @@ namespace core {
|
||||
setBackColor(BG_BLACK);
|
||||
scrollArea(2, 16);
|
||||
status = PROMPT;
|
||||
protocol();
|
||||
protocol(out);
|
||||
break;
|
||||
|
||||
case PROMPT:
|
||||
setCursorLocation(17, 1);
|
||||
clearEOL();
|
||||
out << ("--> ");
|
||||
send();
|
||||
status = INPUT;
|
||||
break;
|
||||
|
||||
@@ -71,13 +68,13 @@ namespace core {
|
||||
command = std::string(data);
|
||||
command.erase(command.find_last_not_of("\r\n\t") + 1);
|
||||
status = PROCESS;
|
||||
protocol();
|
||||
protocol(out);
|
||||
break;
|
||||
|
||||
case PROCESS:
|
||||
doCommand(command);
|
||||
status = (command == "exit")? DONE: PROMPT;
|
||||
protocol();
|
||||
protocol(out);
|
||||
break;
|
||||
|
||||
case DONE:
|
||||
@@ -93,18 +90,18 @@ namespace core {
|
||||
void ConsoleSession::writeLog(std::string data) {
|
||||
saveCursor();
|
||||
setCursorLocation(16, 1);
|
||||
out << data;
|
||||
restoreCursor();
|
||||
send();
|
||||
send(data);
|
||||
}
|
||||
|
||||
void ConsoleSession::doCommand(std::string request) {
|
||||
saveCursor();
|
||||
setCursorLocation(16, 1);
|
||||
out << "--> " << request << std::endl;
|
||||
server.commands.processRequest(request, this, out);
|
||||
restoreCursor();
|
||||
send();
|
||||
}
|
||||
saveCursor();
|
||||
setCursorLocation(16, 1);
|
||||
std::stringstream out;
|
||||
out << "--> " << request << std::endl;
|
||||
server.commands.processRequest(request, this, out);
|
||||
restoreCursor();
|
||||
send(out.str());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user