diff options
Diffstat (limited to 'src/broker.cc')
-rw-r--r-- | src/broker.cc | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/broker.cc b/src/broker.cc index 4fa9ec8..3270702 100644 --- a/src/broker.cc +++ b/src/broker.cc @@ -8,21 +8,18 @@ #include "broker.h" #include "convert.h" -#include "operators.h" -#include "recursivedescent.h" -#include "session.h" - -#include <map> -#include <string> using namespace Binc; using std::string; BrokerFactory::BrokerFactory() { - brokers[Session::State::NONAUTHENTICATED] = new Broker(); - brokers[Session::State::AUTHENTICATED] = new Broker(); - brokers[Session::State::SELECTED] = new Broker(); + auto &session = Session::getInstance(); + Parser p(session); + + brokers[Session::State::NONAUTHENTICATED] = new Broker(p); + brokers[Session::State::AUTHENTICATED] = new Broker(p); + brokers[Session::State::SELECTED] = new Broker(p); } BrokerFactory::~BrokerFactory() @@ -102,7 +99,7 @@ Parser::ParseResult Broker::parseStub(Request &command) string tag; string cmd; - switch (expectTag(tag)) { + switch (parser.expectTag(tag)) { case ACCEPT: break; case REJECT: @@ -114,7 +111,7 @@ Parser::ParseResult Broker::parseStub(Request &command) return TIMEOUT; } - switch (expectSPACE()) { + switch (parser.expectSPACE()) { case ACCEPT: break; case REJECT: @@ -126,7 +123,7 @@ Parser::ParseResult Broker::parseStub(Request &command) return TIMEOUT; } - switch (expectAstring(cmd)) { + switch (parser.expectAstring(cmd)) { case ACCEPT: break; case REJECT: @@ -143,7 +140,7 @@ Parser::ParseResult Broker::parseStub(Request &command) if (cmd == "UID") { command.setUidMode(); - switch (expectSPACE()) { + switch (parser.expectSPACE()) { case ACCEPT: break; case REJECT: @@ -155,7 +152,7 @@ Parser::ParseResult Broker::parseStub(Request &command) return TIMEOUT; } - switch (expectAstring(cmd)) { + switch (parser.expectAstring(cmd)) { case ACCEPT: break; case REJECT: |