microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.99k stars 1.65k forks source link

inconsistent http_listener::close #1700

Open garethsb opened 2 years ago

garethsb commented 2 years ago

The different constructors for web::http::experimental::listener::details::http_listener_impl initialize the m_close_task differently.

https://github.com/microsoft/cpprestsdk/blob/07cf589108f50ee40e56c56dc43bfab1022604e0/Release/include/cpprest/http_listener.h#L203-L205

The default constructor that is visible to SDK users since it is inline in the header initializes it like so:

https://github.com/microsoft/cpprestsdk/blob/07cf589108f50ee40e56c56dc43bfab1022604e0/Release/include/cpprest/http_listener.h#L170

However, the other constructors leave the task default initialized:

https://github.com/microsoft/cpprestsdk/blob/07cf589108f50ee40e56c56dc43bfab1022604e0/Release/src/http/listener/http_listener.cpp#L57-L66

A default constructed task behaves quite differently, so this seems like an oversight.