Feature / Adopt externally accepted sockets into uWebSockets. (#1697)

* Adopt externally accepted sockets into uWebSockets.

* Integrate uSockets typo.

---------

Co-authored-by: markus <markus.kuehni@triviso.ch>
This commit is contained in:
markmaker
2024-01-22 07:31:28 +01:00
committed by GitHub
parent 97a72ed31f
commit b898000e89
3 changed files with 12 additions and 1 deletions
+6
View File
@@ -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);
+5
View File
@@ -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<SSL>));
}
/* 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<SSL>), 0, 0);
}
};
}