Working app.close

This commit is contained in:
Alex Hultman
2022-12-28 07:09:17 +01:00
parent c603228a69
commit a703f6c493
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -249,12 +249,14 @@ public:
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *, int, std::string_view)> close = nullptr;
};
/* Closes all sockets. Does not close listen sockets. */
TemplatedApp &&closeSockets() {
us_socket_context_close(SSL, httpContext);
/* Closes all sockets including listen sockets. */
TemplatedApp &&close() {
us_socket_context_close(SSL, (struct us_socket_context_t *) httpContext);
for (void *webSocketContext : webSocketContexts) {
us_socket_context_close(SSL, webSocketContext);
us_socket_context_close(SSL, (struct us_socket_context_t *) webSocketContext);
}
return std::move(*this);
}
template <typename UserData>