aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-05-04 16:05:17 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-05-05 08:27:12 +0200
commitf0188f9178a22fd493ed228c008d4cc25ac2952d (patch)
tree9277158f758727c16e6b1dc0451f53d834d82862 /src/httpserver.cpp
parent37b21372a0a3e5d876a87f03c8cbef2e02d8dc92 (diff)
http: use std::move to move HTTPRequest into HTTPWorkItem
Thanks to Cory Fields for the idea.
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index c193d2af1b..812940eaf9 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -44,8 +44,8 @@ static const size_t MAX_HEADERS_SIZE = 8192;
class HTTPWorkItem : public HTTPClosure
{
public:
- HTTPWorkItem(HTTPRequest* req, const std::string &path, const HTTPRequestHandler& func):
- req(req), path(path), func(func)
+ HTTPWorkItem(std::unique_ptr<HTTPRequest> req, const std::string &path, const HTTPRequestHandler& func):
+ req(std::move(req)), path(path), func(func)
{
}
void operator()()
@@ -281,7 +281,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
// Dispatch to worker thread
if (i != iend) {
- std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
+ std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(std::move(hreq), path, i->handler));
assert(workQueue);
if (workQueue->Enqueue(item.get()))
item.release(); /* if true, queue took ownership */