diff --git a/Release/include/cpprest/http_listener.h b/Release/include/cpprest/http_listener.h index c8059e02ba..4e6acc4815 100644 --- a/Release/include/cpprest/http_listener.h +++ b/Release/include/cpprest/http_listener.h @@ -270,7 +270,16 @@ class http_listener /// Destructor frees any held resources. /// /// Call close() before allowing a listener to be destroyed. - _ASYNCRTIMP ~http_listener(); + ~http_listener() { + if (m_impl) { + // As a safe guard close the listener if not already done. + // Users are required to call close, but this is just a safeguard. + try { + m_impl->close().wait(); + } catch (...) { + } + } + } /// /// Asynchronously open the listener, i.e. start accepting requests. diff --git a/Release/src/http/listener/http_listener.cpp b/Release/src/http/listener/http_listener.cpp index baa204b56d..423adfe00b 100644 --- a/Release/src/http/listener/http_listener.cpp +++ b/Release/src/http/listener/http_listener.cpp @@ -63,21 +63,6 @@ details::http_listener_impl::http_listener_impl(http::uri address, http_listener check_listener_uri(m_uri); } -http_listener::~http_listener() -{ - if(m_impl) - { - // As a safe guard close the listener if not already done. - // Users are required to call close, but this is just a safeguard. - try - { - close().wait(); - } catch(...) - { - } - } -} - pplx::task details::http_listener_impl::open() { // Do nothing if the open operation was already attempted