add banner

This commit is contained in:
an-tao 2018-05-04 17:51:22 +08:00
parent f42da49a80
commit 26bda82b25
3 changed files with 17 additions and 4 deletions

View File

@ -1,7 +1,16 @@
#include <drogon/HttpAppFramework.h>
#include <iostream>
static const char banner[]=" _ \n"
" __| |_ __ ___ __ _ ___ _ __ \n"
" / _` | '__/ _ \\ / _` |/ _ \\| '_ \\ \n"
"| (_| | | | (_) | (_| | (_) | | | |\n"
" \\__,_|_| \\___/ \\__, |\\___/|_| |_|\n"
" |___/ \n";
int main()
{
std::cout<<banner<<std::endl;
drogon::HttpAppFramework framework("0.0.0.0",12345);
trantor::Logger::setLogLevel(trantor::Logger::TRACE);
framework.run();
}
}

View File

@ -50,7 +50,7 @@ public:
CallbackBucket tmp;
{
std::lock_guard<std::mutex> lock(bucketMutex_);
//use tmp to make this critical area as short as possible.
//use tmp val to make this critical area as short as possible.
event_bucket_queue_.front().swap(tmp);
event_bucket_queue_.pop_front();
event_bucket_queue_.push_back(CallbackBucket());
@ -89,7 +89,7 @@ public:
{
timeout=map_[key].timeout;
}
if(timeout)
if(timeout>0)
eraseAfter(timeout,key);
@ -105,7 +105,7 @@ public:
timeout=map_[key].timeout;
flag=true;
}
if(timeout)
if(timeout>0)
eraseAfter(timeout,key);

View File

@ -188,6 +188,10 @@ public:
{
body_ = body;
}
void setBody(std::string&& body)
{
body_ = std::move(body);
}
void redirect(const std::string& url)
{
headers_["Location"] = url;