From 26bda82b2548419c2fe28b8a9167d051315a1719 Mon Sep 17 00:00:00 2001 From: an-tao <20741618@qq.com> Date: Fri, 4 May 2018 17:51:22 +0800 Subject: [PATCH] add banner --- examples/static_link_example/main.cc | 11 ++++++++++- lib/inc/drogon/CacheMap.h | 6 +++--- lib/inc/drogon/HttpResponse.h | 4 ++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/static_link_example/main.cc b/examples/static_link_example/main.cc index b31a2896..45e44c70 100755 --- a/examples/static_link_example/main.cc +++ b/examples/static_link_example/main.cc @@ -1,7 +1,16 @@ #include +#include +static const char banner[]=" _ \n" + " __| |_ __ ___ __ _ ___ _ __ \n" + " / _` | '__/ _ \\ / _` |/ _ \\| '_ \\ \n" + "| (_| | | | (_) | (_| | (_) | | | |\n" + " \\__,_|_| \\___/ \\__, |\\___/|_| |_|\n" + " |___/ \n"; + int main() { + std::cout< 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); diff --git a/lib/inc/drogon/HttpResponse.h b/lib/inc/drogon/HttpResponse.h index d3e85ed6..fa807fdd 100755 --- a/lib/inc/drogon/HttpResponse.h +++ b/lib/inc/drogon/HttpResponse.h @@ -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;