diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/deps/_libusockets.h | 2 | ||||
-rw-r--r-- | src/deps/libuwsockets.cpp | 22 | ||||
-rw-r--r-- | src/deps/uws.zig | 4 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/deps/_libusockets.h b/src/deps/_libusockets.h index affe4dac5..f0ddc6405 100644 --- a/src/deps/_libusockets.h +++ b/src/deps/_libusockets.h @@ -6,8 +6,6 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <uws/src/App.h> -#include <uws/src/AsyncSocket.h> #ifndef STRING_POINTER #define STRING_POINTER diff --git a/src/deps/libuwsockets.cpp b/src/deps/libuwsockets.cpp index 6e4c81356..a3ac0d2f7 100644 --- a/src/deps/libuwsockets.cpp +++ b/src/deps/libuwsockets.cpp @@ -1,8 +1,12 @@ +#include <mimalloc-new-delete.h> + #include "_libusockets.h" -#include <string_view> #include <uws/src/App.h> +#include <uws/src/AsyncSocket.h> + +#include <string_view> #include <uws/uSockets/src/internal/internal.h> extern "C" { @@ -865,12 +869,20 @@ void uws_res_on_aborted(int ssl, uws_res_t *res, void *opcional_data) { if (ssl) { uWS::HttpResponse<true> *uwsRes = (uWS::HttpResponse<true> *)res; - uwsRes->onAborted( - [handler, res, opcional_data] { handler(res, opcional_data); }); + if (handler) { + uwsRes->onAborted( + [handler, res, opcional_data] { handler(res, opcional_data); }); + } else { + uwsRes->onAborted(nullptr); + } } else { uWS::HttpResponse<false> *uwsRes = (uWS::HttpResponse<false> *)res; - uwsRes->onAborted( - [handler, res, opcional_data] { handler(res, opcional_data); }); + if (handler) { + uwsRes->onAborted( + [handler, res, opcional_data] { handler(res, opcional_data); }); + } else { + uwsRes->onAborted(nullptr); + } } } diff --git a/src/deps/uws.zig b/src/deps/uws.zig index 3ee4a38cf..fccc01837 100644 --- a/src/deps/uws.zig +++ b/src/deps/uws.zig @@ -823,6 +823,10 @@ pub fn NewApp(comptime ssl: bool) type { uws_res_on_aborted(ssl_flag, res.downcast(), Wrapper.handle, opcional_data); } + pub fn clearAborted(res: *Response) void { + uws_res_on_aborted(ssl_flag, res.downcast(), null, null); + } + pub fn onData( res: *Response, comptime UserDataType: type, |