From d73c68540dcbec2e4c997b940144d9246828439c Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 6 Apr 2012 10:33:22 -0700 Subject: Stopping the http server now will wait for the listener to stop properly. --- src/HttpServer.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/HttpServer.cc') diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 9fc48c5..44c794e 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -600,8 +600,14 @@ void Balau::HttpServer::start() { void Balau::HttpServer::stop() { AAssert(m_started, "Don't stop an HttpServer that hasn't been started"); - reinterpret_cast(m_listenerPtr)->stop(); + HttpListener * listener = reinterpret_cast(m_listenerPtr); + Events::TaskEvent event(listener); + Task::prepare(&event); + listener->stop(); m_started = false; + Task::yield(&event); + IAssert(event.gotSignal(), "HttpServer::stop didn't actually get the listener to stop"); + event.ack(); } void Balau::HttpServer::registerAction(Action * action) { -- cgit v1.2.3