Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,17 +563,21 @@ namespace crow
else
#endif
{
// TODO(EDev): Move these 6 lines to a method in http_server.
std::vector<crow::websocket::connection*> websockets_to_close = websockets_;
for (auto websocket : websockets_to_close)
{
CROW_LOG_INFO << "Quitting Websocket: " << websocket;
websocket->close("Server Application Terminated");
}
close_websockets();
if (server_) { server_->stop(); }
}
}

void close_websockets()
{
for (auto websocket : websockets_)
{
CROW_LOG_INFO << "Quitting Websocket: " << websocket;
websocket->close("Websocket Closed");
}
}


void add_websocket(crow::websocket::connection* conn)
{
websockets_.push_back(conn);
Expand Down
1 change: 1 addition & 0 deletions include/crow/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
io_context_.stop(); // Close main io_service
}


uint16_t port() const {
return acceptor_.local_endpoint().port();
}
Expand Down
Loading