diff --git a/drogon_ctl/create_model.cc b/drogon_ctl/create_model.cc index d16432eb..71566dcc 100644 --- a/drogon_ctl/create_model.cc +++ b/drogon_ctl/create_model.cc @@ -14,7 +14,6 @@ #include "create_model.h" #include "cmd.h" - #include #include #include diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index 9ac5aeea..2c80a065 100755 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -22,7 +22,6 @@ #include #include #include - #include #include #include diff --git a/lib/src/HttpClientImpl.cc b/lib/src/HttpClientImpl.cc index e0792c57..0f41fde2 100644 --- a/lib/src/HttpClientImpl.cc +++ b/lib/src/HttpClientImpl.cc @@ -18,8 +18,10 @@ #include "HttpAppFrameworkImpl.h" #include #include + using namespace drogon; using namespace std::placeholders; + HttpClientImpl::HttpClientImpl(trantor::EventLoop *loop, const trantor::InetAddress &addr, bool useSSL) @@ -28,6 +30,7 @@ HttpClientImpl::HttpClientImpl(trantor::EventLoop *loop, _useSSL(useSSL) { } + HttpClientImpl::HttpClientImpl(trantor::EventLoop *loop, const std::string &hostString) : _loop(loop) @@ -83,16 +86,19 @@ HttpClientImpl::HttpClientImpl(trantor::EventLoop *loop, } LOG_TRACE << "userSSL=" << _useSSL << " domain=" << _domain; } + HttpClientImpl::~HttpClientImpl() { LOG_TRACE << "Deconstruction HttpClient"; } + void HttpClientImpl::sendRequest(const drogon::HttpRequestPtr &req, const drogon::HttpReqCallback &callback) { _loop->runInLoop([=]() { sendRequestInLoop(req, callback); }); } + void HttpClientImpl::sendRequestInLoop(const drogon::HttpRequestPtr &req, const drogon::HttpReqCallback &callback) { @@ -105,7 +111,7 @@ void HttpClientImpl::sendRequestInLoop(const drogon::HttpRequestPtr &req, _server.portNetEndian() != 0) { //dns - //TODO:timeout should be set by user + //TODO: timeout should be set by user if (InetAddress::resolve(_domain, &_server) == false) { callback(ReqResult::BadServerAddress, diff --git a/lib/src/HttpControllersRouter.cc b/lib/src/HttpControllersRouter.cc index 9b4e3db9..ff8377f2 100644 --- a/lib/src/HttpControllersRouter.cc +++ b/lib/src/HttpControllersRouter.cc @@ -116,7 +116,6 @@ void HttpControllersRouter::addHttpPath(const std::string &path, } } } - struct HttpControllerRouterItem router; router.pathParameterPattern = pathParameterPattern; if (validMethods.size() > 0) @@ -142,7 +141,7 @@ void HttpControllersRouter::route(const HttpRequestImplPtr &req, bool needSetJsessionid, std::string &&sessionId) { - //find http controller + //Find http controller if (_ctrlRegex.mark_count() > 0) { std::smatch result; @@ -168,7 +167,6 @@ void HttpControllersRouter::route(const HttpRequestImplPtr &req, callback(res); return; } - auto &filters = binder->filtersName; if (!filters.empty()) { @@ -234,7 +232,6 @@ void HttpControllersRouter::doControllerHandler(const CtrlBinderPtr &ctrlBinderP } return; } - std::vector params(ctrlBinderPtr->parameterPlaces.size()); std::smatch r; if (std::regex_match(req->path(), r, routerItem._regex)) @@ -269,7 +266,6 @@ void HttpControllersRouter::doControllerHandler(const CtrlBinderPtr &ctrlBinderP LOG_TRACE << p; paraList.push_back(std::move(p)); } - ctrlBinderPtr->binderPtr->handleHttpRequest(paraList, req, [=, callback = std::move(callback), sessionId = std::move(sessionId)](const HttpResponsePtr &resp) { LOG_TRACE << "http resp:needSetJsessionid=" << needSetJsessionid << ";JSESSIONID=" << sessionId; auto newResp = resp; diff --git a/lib/src/HttpRequestParser.cc b/lib/src/HttpRequestParser.cc index 180666c5..27601655 100755 --- a/lib/src/HttpRequestParser.cc +++ b/lib/src/HttpRequestParser.cc @@ -17,14 +17,17 @@ #include "HttpRequestParser.h" #include "HttpResponseImpl.h" #include + using namespace trantor; using namespace drogon; + HttpRequestParser::HttpRequestParser(const trantor::TcpConnectionPtr &connPtr) : _state(kExpectRequestLine), _request(new HttpRequestImpl), _conn(connPtr) { } + bool HttpRequestParser::processRequestLine(const char *begin, const char *end) { bool succeed = false; @@ -122,7 +125,7 @@ bool HttpRequestParser::parseRequest(MsgBuffer *buf) _request->getVersion() >= HttpRequest::kHttp11) { //rfc2616-8.2.3 - //TODO:here we can add content-length limitation + //TODO: here we can add content-length limitation auto connPtr = _conn.lock(); if (connPtr) { @@ -209,6 +212,7 @@ void HttpRequestParser::pushRquestToPipeLine(const HttpRequestPtr &req) _requestPipeLine.push_back(std::move(reqPair)); } + HttpRequestPtr HttpRequestParser::getFirstRequest() const { #ifndef NDEBUG @@ -224,6 +228,7 @@ HttpRequestPtr HttpRequestParser::getFirstRequest() const } return HttpRequestImplPtr(); } + HttpResponsePtr HttpRequestParser::getFirstResponse() const { #ifndef NDEBUG @@ -239,6 +244,7 @@ HttpResponsePtr HttpRequestParser::getFirstResponse() const } return HttpResponseImplPtr(); } + void HttpRequestParser::popFirstRequest() { #ifndef NDEBUG @@ -250,6 +256,7 @@ void HttpRequestParser::popFirstRequest() #endif _requestPipeLine.pop_front(); } + void HttpRequestParser::pushResponseToPipeLine(const HttpRequestPtr &req, const HttpResponsePtr &resp) { @@ -268,9 +275,4 @@ void HttpRequestParser::pushResponseToPipeLine(const HttpRequestPtr &req, return; } } -} - -// std::mutex &HttpRequestParser::getPipeLineMutex() -// { -// return *_pipeLineMutex; -// } +} \ No newline at end of file diff --git a/lib/src/SharedLibManager.cc b/lib/src/SharedLibManager.cc index be36870d..0a79b601 100755 --- a/lib/src/SharedLibManager.cc +++ b/lib/src/SharedLibManager.cc @@ -117,7 +117,7 @@ void SharedLibManager::managerLibs() cmd.append(filename).append(" -o ").append(libPath); LOG_TRACE << cmd; auto r = system(cmd.c_str()); - //TODO:handle r + //TODO: handle r (void)(r); auto srcFile = filename.substr(0, pos); srcFile.append(".cc"); diff --git a/orm_lib/src/mysql_impl/MysqlConnection.cc b/orm_lib/src/mysql_impl/MysqlConnection.cc index e58951a5..939b613e 100644 --- a/orm_lib/src/mysql_impl/MysqlConnection.cc +++ b/orm_lib/src/mysql_impl/MysqlConnection.cc @@ -419,7 +419,7 @@ void MysqlConnection::outputError() try { - //TODO exception type + //TODO: exception type throw SqlError(mysql_error(_mysqlPtr.get()), _sql); } diff --git a/orm_lib/src/postgresql_impl/PgConnection.cc b/orm_lib/src/postgresql_impl/PgConnection.cc index 5ae6446e..3466ae90 100644 --- a/orm_lib/src/postgresql_impl/PgConnection.cc +++ b/orm_lib/src/postgresql_impl/PgConnection.cc @@ -19,6 +19,7 @@ #include using namespace drogon::orm; + namespace drogon { namespace orm @@ -72,10 +73,7 @@ PgConnection::PgConnection(trantor::EventLoop *loop, const std::string &connInfo _channel.enableReading(); _channel.enableWriting(); } -// int PgConnection::sock() -// { -// return PQsocket(_connPtr.get()); -// } + void PgConnection::handleClosed() { _loop->assertInLoopThread(); @@ -88,6 +86,7 @@ void PgConnection::handleClosed() auto thisPtr = shared_from_this(); _closeCb(thisPtr); } + void PgConnection::disconnect() { std::promise pro; @@ -102,6 +101,7 @@ void PgConnection::disconnect() }); f.get(); } + void PgConnection::pgPoll() { _loop->assertInLoopThread(); @@ -146,6 +146,7 @@ void PgConnection::pgPoll() break; } } + void PgConnection::execSql(std::string &&sql, size_t paraNum, std::vector &¶meters, @@ -185,6 +186,7 @@ void PgConnection::execSql(std::string &&sql, thisPtr->pgPoll(); }); } + void PgConnection::handleRead() { _loop->assertInLoopThread(); @@ -216,7 +218,6 @@ void PgConnection::handleRead() handleClosed(); return; } - if (PQisBusy(_connPtr.get())) { //need read more data from socket; @@ -238,7 +239,7 @@ void PgConnection::handleRead() { try { - //TODO exception type + //TODO: exception type throw SqlError(PQerrorMessage(_connPtr.get()), _sql); }