Skip to content

Commit 0a26843

Browse files
committed
Added fix for codeplex 192
1 parent 3445f61 commit 0a26843

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Release/include/cpprest/http_listener.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class http_listener_impl
139139

140140
http_listener_impl()
141141
: m_closed(true)
142+
, m_close_task(pplx::task_from_result())
142143
{
143144
}
144145

@@ -176,6 +177,7 @@ class http_listener_impl
176177

177178
// Used to record that the listener is closed.
178179
bool m_closed;
180+
pplx::task<void> m_close_task;
179181
};
180182

181183
} // namespace details
@@ -315,4 +317,4 @@ class http_listener
315317
} // namespace http
316318
} // namespace web
317319

318-
#endif /* _CASA_HTTP_LISTENER_H */
320+
#endif /* _CASA_HTTP_LISTENER_H */

Release/src/http/listener/http_listener.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ pplx::task<void> details::http_listener_impl::close()
131131
{
132132
// Do nothing if the close operation was already attempted
133133
// Not thread safe.
134-
if (m_closed) return pplx::task_from_result();
134+
// Note: Return the previous close task
135+
if (m_closed) return m_close_task;
135136

136137
m_closed = true;
137-
return web::http::experimental::details::http_server_api::unregister_listener(this);
138+
m_close_task = web::http::experimental::details::http_server_api::unregister_listener(this);
139+
return m_close_task;
138140
}
139141

140142
void details::http_listener_impl::handle_request(http_request msg)

0 commit comments

Comments
 (0)