From e653e9d3142f8a9a9d76548e288652ab46729766 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Wed, 23 Jan 2019 12:31:25 +0100 Subject: [PATCH] Make HttpParser only handle move-only functions --- src/HttpParser.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/HttpParser.h b/src/HttpParser.h index bd59743..dba55ee 100644 --- a/src/HttpParser.h +++ b/src/HttpParser.h @@ -25,6 +25,8 @@ #include #include +#include "f2/function2.hpp" + namespace uWS { class HttpRequest { @@ -138,7 +140,7 @@ private: // the only caller of getHeaders template - std::pair fenceAndConsumePostPadded(char *data, int length, void *user, HttpRequest *req, std::function &requestHandler, std::function &dataHandler) { + std::pair fenceAndConsumePostPadded(char *data, int length, void *user, HttpRequest *req, fu2::unique_function &requestHandler, fu2::unique_function &dataHandler) { int consumedTotal = 0; data[length] = '\r'; @@ -191,7 +193,7 @@ private: public: // todo: what can we do with the socket inside the handlers? we need to check on return from any handler if we closed or terminated or upgraded the socket - void *consumePostPadded(char *data, int length, void *user, std::function &&requestHandler, std::function &&dataHandler, std::function &&errorHandler) { + void *consumePostPadded(char *data, int length, void *user, fu2::unique_function &&requestHandler, fu2::unique_function &&dataHandler, fu2::unique_function &&errorHandler) { HttpRequest req;