File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed
Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -563,11 +563,22 @@ namespace crow
563563 else
564564#endif
565565 {
566- server_-> close_websockets (websockets_);
566+ close_websockets (websockets_);
567567 if (server_) { server_->stop (); }
568568 }
569569 }
570570
571+ void close_websockets (const std::vector<crow::websocket::connection*>& websockets)
572+ {
573+ std::vector<crow::websocket::connection*> websockets_to_close = websockets;
574+ for (auto websocket : websockets_to_close)
575+ {
576+ CROW_LOG_INFO << " Quitting Websocket: " << websocket;
577+ websocket->close (" Websocket Closed" );
578+ }
579+ }
580+
581+
571582 void add_websocket (crow::websocket::connection* conn)
572583 {
573584 websockets_.push_back (conn);
Original file line number Diff line number Diff line change @@ -251,18 +251,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
251251 io_context_.stop (); // Close main io_service
252252 }
253253
254- void close_websockets (const std::vector<crow::websocket::connection*>& websockets,
255- const std::string& reason = " Server Application Terminated" )
256- {
257- // Make a copy to avoid issues if closing modifies the original collection
258- std::vector<crow::websocket::connection*> websockets_to_close = websockets;
259- for (auto websocket : websockets_to_close)
260- {
261- CROW_LOG_INFO << " Quitting Websocket: " << websocket;
262- websocket->close (reason);
263- }
264- }
265-
254+
266255 uint16_t port () const {
267256 return acceptor_.local_endpoint ().port ();
268257 }
You can’t perform that action at this time.
0 commit comments