diff --git a/src/App.h b/src/App.h index 10ca423..904e218 100644 --- a/src/App.h +++ b/src/App.h @@ -575,6 +575,12 @@ public: return std::move(*this); } + /* adopt an externally accepted socket */ + TemplatedApp &&adoptSocket(LIBUS_SOCKET_DESCRIPTOR accepted_fd) { + httpContext->adoptAcceptedSocket(accepted_fd); + return std::move(*this); + } + TemplatedApp &&run() { uWS::run(); return std::move(*this); diff --git a/src/HttpContext.h b/src/HttpContext.h index f66b6ea..11d1a4e 100644 --- a/src/HttpContext.h +++ b/src/HttpContext.h @@ -482,6 +482,11 @@ public: us_listen_socket_t *listen(const char *path, int options) { return us_socket_context_listen_unix(SSL, getSocketContext(), path, options, sizeof(HttpResponseData)); } + + /* Adopt an externally accepted socket into this HttpContext */ + us_socket_t *adoptAcceptedSocket(LIBUS_SOCKET_DESCRIPTOR accepted_fd) { + return us_adopt_accepted_socket(SSL, getSocketContext(), accepted_fd, sizeof(HttpResponseData), 0, 0); + } }; } diff --git a/uSockets b/uSockets index a15d9bb..07654e4 160000 --- a/uSockets +++ b/uSockets @@ -1 +1 @@ -Subproject commit a15d9bbdea68fd02dab40d2394200deb1b883aa6 +Subproject commit 07654e4fb998e5c8ca6c94856bb660c8a53c1846