Format some files for good code style (#196)

This commit is contained in:
An Tao 2019-07-16 20:00:20 +08:00 committed by GitHub
parent 007fee1043
commit 33577b9666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 12 deletions

View File

@ -21,7 +21,8 @@ void help::handleCommand(std::vector<std::string> &parameters)
{
if (parameters.size() == 0)
{
std::cout << "usage: drogon_ctl [-v | --version] [-h | --help] <command> [<args>]"
std::cout << "usage: drogon_ctl [-v | --version] [-h | --help] "
"<command> [<args>]"
<< std::endl;
std::cout << "commands list:" << std::endl;
for (auto &className : drogon::DrClassMap::getAllClassName())

View File

@ -58,7 +58,7 @@ class press : public DrObject<press>, public CommandHandler
size_t _numOfThreads = 1;
size_t _numOfRequests = 1;
size_t _numOfConnections = 1;
//bool _keepAlive = false;
// bool _keepAlive = false;
bool _processIndication = true;
std::string _url;
std::string _host;
@ -70,6 +70,5 @@ class press : public DrObject<press>, public CommandHandler
std::unique_ptr<trantor::EventLoopThreadPool> _loopPool;
std::vector<HttpClientPtr> _clients;
Statistics _stat;
};
} // namespace drogon_ctl

View File

@ -34,7 +34,7 @@ class ApiTest : public drogon::HttpController<ApiTest>
METHOD_ADD(ApiTest::jsonTest, "/json", Post);
METHOD_ADD(ApiTest::formTest, "/form", Post);
METHOD_LIST_END
void get(const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback,
int p1,

View File

@ -176,17 +176,17 @@ int main()
{
std::cout << "empty custom config!" << std::endl;
}
// Install custom controller
auto ctrlPtr = std::make_shared<CustomCtrl>("Hi");
app().registerController(ctrlPtr);
// Install custom filter
auto filterPtr =
std::make_shared<CustomHeaderFilter>("custom_header", "yes");
app().registerFilter(filterPtr);
app().setIdleConnectionTimeout(30s);
// AOP example
app().registerBeginningAdvice(
[]() { LOG_DEBUG << "Event loop is running!"; });
@ -264,6 +264,6 @@ int main()
}
std::cout << std::get<2>(info) << std::endl;
}
app().run();
}

View File

@ -64,7 +64,8 @@ char *CacheFile::data()
fflush(_file);
auto fd = fileno(_file);
_dataLength = length();
_data = static_cast<char *>(mmap(nullptr, _dataLength, PROT_READ, MAP_SHARED, fd, 0));
_data = static_cast<char *>(
mmap(nullptr, _dataLength, PROT_READ, MAP_SHARED, fd, 0));
if (_data == MAP_FAILED)
{
_data = nullptr;

View File

@ -202,7 +202,7 @@ void HttpAppFrameworkImpl::setSSLFiles(const std::string &certPath,
void HttpAppFrameworkImpl::run()
{
//
LOG_INFO << "Start to run...";
LOG_TRACE << "Start to run...";
trantor::AsyncFileLogger asyncFileLogger;
// Create dirs for cache files
for (int i = 0; i < 256; i++)

View File

@ -64,7 +64,8 @@ class ListenerManager : public trantor::NonCopyable
};
std::vector<ListenerInfo> _listeners;
std::vector<std::shared_ptr<HttpServer>> _servers;
std::vector<std::shared_ptr<trantor::EventLoopThread>> _listeningloopThreads;
std::vector<std::shared_ptr<trantor::EventLoopThread>>
_listeningloopThreads;
std::string _sslCertPath;
std::string _sslKeyPath;
std::shared_ptr<trantor::EventLoopThreadPool> _ioLoopThreadPoolPtr;

View File

@ -164,7 +164,7 @@ class DbClient : public trantor::NonCopyable
* @param commitCallback: the callback with which user can get the
* submitting result, The Boolean type parameter in the callback function
* indicates whether the transaction was submitted successfully.
*
*
* NOTE: The callback only indicates the result of the 'commit' command,
* which is the last step of the transaction. If the transaction has been
* automatically or manually rolled back, the callback will never be