Make onAborted unique_function

This commit is contained in:
Alex Hultman
2019-01-17 06:30:47 +01:00
parent 0ca061e772
commit 6718301ac9
3 changed files with 3 additions and 5 deletions
-2
View File
@@ -67,8 +67,6 @@ int main(int argc, char **argv) {
} }
}).run(); }).run();
/* This is needed to properly free default loop and such resources */
uWS::destroy();
std::cout << "Everything fine, falling through" << std::endl; std::cout << "Everything fine, falling through" << std::endl;
+2 -2
View File
@@ -239,10 +239,10 @@ public:
} }
/* Attach handler for aborted HTTP request */ /* Attach handler for aborted HTTP request */
HttpResponse *onAborted(std::function<void()> handler) { HttpResponse *onAborted(fu2::unique_function<void()> &&handler) {
HttpResponseData<SSL> *httpResponseData = getHttpResponseData(); HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
httpResponseData->onAborted = handler; httpResponseData->onAborted = std::move(handler);
return this; return this;
} }
+1 -1
View File
@@ -44,7 +44,7 @@ private:
/* Per socket event handlers */ /* Per socket event handlers */
fu2::unique_function<bool(int)> onWritable; fu2::unique_function<bool(int)> onWritable;
std::function<void()> onAborted; fu2::unique_function<void()> onAborted;
//std::function<void()> onData; //std::function<void()> onData;
std::function<void(std::string_view, bool)> inStream; std::function<void(std::string_view, bool)> inStream;