Skip to content

Commit

Permalink
Working app.close
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Dec 28, 2022
1 parent c603228 commit a703f6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ struct TemplatedApp {
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>
Expand Down
2 changes: 1 addition & 1 deletion uSockets

0 comments on commit a703f6c

Please sign in to comment.