We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34f9948 commit 3a88039Copy full SHA for 3a88039
1 file changed
include/crow/http_server.h
@@ -184,6 +184,16 @@ namespace crow // NOTE: Already documented in "crow/app.h"
184
void stop()
185
{
186
shutting_down_ = true; // Prevent the acceptor from taking new connections
187
+
188
+ // Explicitly close the acceptor
189
+ // else asio will throw an exception (linux only), when trying to start server again:
190
+ // what(): bind: Address already in use
191
+ if (acceptor_.is_open())
192
+ {
193
+ CROW_LOG_INFO << "Closing acceptor. " << &acceptor_;
194
+ acceptor_.close();
195
+ }
196
197
for (auto& io_context : io_context_pool_)
198
199
if (io_context != nullptr)
0 commit comments