Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _ASYNCRTIMP from ~http_listener() and implement inline #937

Merged
merged 1 commit into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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