Try using function2 for HttpResponse::onWritable
This commit is contained in:
+3
-1
@@ -25,6 +25,8 @@
|
|||||||
#include "HttpContextData.h"
|
#include "HttpContextData.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
#include "f2/function2.hpp"
|
||||||
|
|
||||||
/* todo: tryWrite is missing currently, only send smaller segments with write */
|
/* todo: tryWrite is missing currently, only send smaller segments with write */
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
@@ -229,7 +231,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Attach handler for writable HTTP response */
|
/* Attach handler for writable HTTP response */
|
||||||
HttpResponse *onWritable(std::function<bool(int)> handler) {
|
HttpResponse *onWritable(fu2::unique_function<bool(int)> handler) {
|
||||||
HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
|
HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
|
||||||
|
|
||||||
httpResponseData->onWritable = handler;
|
httpResponseData->onWritable = handler;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
#include "AsyncSocketData.h"
|
#include "AsyncSocketData.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#include "f2/function2.hpp"
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
template <bool SSL>
|
template <bool SSL>
|
||||||
@@ -41,7 +43,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Per socket event handlers */
|
/* Per socket event handlers */
|
||||||
std::function<bool(int)> onWritable;
|
fu2::unique_function<bool(int)> onWritable;
|
||||||
std::function<void()> onAborted;
|
std::function<void()> onAborted;
|
||||||
//std::function<void()> onData;
|
//std::function<void()> onData;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user