Construct Server after Overlay and WSDoors:

When the ServerHandler is constructed before the Overlay, an incoming
connection received after the server's listening ports have been opened
but before the Overlay object has been created causes a crash.
This commit is contained in:
Vinnie Falco
2014-11-12 05:13:14 -08:00
parent 737b33f9d1
commit f24e859f17

View File

@@ -706,12 +706,6 @@ public:
//
//----------------------------------------------------------------------
{
auto setup = setup_ServerHandler(getConfig(), std::cerr);
setup.makeContexts();
serverHandler_->setup (setup, m_journal);
}
// VFALCO NOTE Unfortunately, in stand-alone mode some code still
// foolishly calls overlay(). When this is fixed we can
// move the instantiation inside a conditional:
@@ -723,6 +717,12 @@ public:
get_io_service());
add (*m_overlay); // add to PropertyStream
{
auto setup = setup_ServerHandler(getConfig(), std::cerr);
setup.makeContexts();
serverHandler_->setup (setup, m_journal);
}
// Create websocket doors
for (auto const& port : serverHandler_->setup().ports)
{