Skip to content

Commit

Permalink
Remove _ASYNCRTIMP from ~http_listener() and implement inline
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannis-e committed Oct 2, 2018
1 parent f897582 commit f743245
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
11 changes: 10 additions & 1 deletion Release/include/cpprest/http_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,16 @@ class http_listener
/// Destructor frees any held resources.
/// </summary>
/// <remarks>Call close() before allowing a listener to be destroyed.</remarks>
_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 (...) {
}
}
}

/// <summary>
/// Asynchronously open the listener, i.e. start accepting requests.
Expand Down
15 changes: 0 additions & 15 deletions Release/src/http/listener/http_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> details::http_listener_impl::open()
{
// Do nothing if the open operation was already attempted
Expand Down

0 comments on commit f743245

Please sign in to comment.