-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Remove pplx::task from public API #8747
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
Conversation
b1bf056
to
0cffafa
Compare
ed46001
to
d4915e8
Compare
src/SignalR/clients/cpp/samples/HubConnectionSample/HubConnectionSample.cpp
Show resolved
Hide resolved
src/SignalR/clients/cpp/samples/HubConnectionSample/HubConnectionSample.cpp
Show resolved
Hide resolved
src/SignalR/clients/cpp/src/signalrclient/hub_connection_impl.cpp
Outdated
Show resolved
Hide resolved
src/SignalR/clients/cpp/src/signalrclient/hub_connection_impl.cpp
Outdated
Show resolved
Hide resolved
{ | ||
return m_pImpl->start(); | ||
m_pImpl->start(callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need checks for the implementation object here as well?
} | ||
|
||
ucout << U("Enter your message:"); | ||
for (;;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while true lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for for (;;)
lol
|
||
SIGNALRCLIENT_API pplx::task<void> __cdecl send(const std::string& data); | ||
SIGNALRCLIENT_API void __cdecl send(const std::string& data, std::function<void(std::exception_ptr)> callback) noexcept; | ||
|
||
SIGNALRCLIENT_API void __cdecl set_message_received(const message_received_handler& message_received_callback); | ||
SIGNALRCLIENT_API void __cdecl set_disconnected(const std::function<void __cdecl()>& disconnected_callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to have set_disconnected's completion callback take an exception as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, I'll track that in our public API review issue #8717
@@ -29,16 +28,16 @@ namespace signalr | |||
|
|||
connection& operator=(const connection&) = delete; | |||
|
|||
SIGNALRCLIENT_API pplx::task<void> __cdecl start(); | |||
SIGNALRCLIENT_API void __cdecl start(std::function<void(std::exception_ptr)> callback) noexcept; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these callbacks be marked noexcept too? std::function<void(std::exception_ptr) noexcept>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, but I don't think it works
https://godbolt.org/z/dI2GuJ
{ | ||
if (!m_pImpl) | ||
{ | ||
throw signalr_exception("invoke() cannot be called on uninitialized hub_connection instance"); | ||
callback(web::json::value(), std::make_exception_ptr(signalr_exception("invoke() cannot be called on destructed hub_connection instance"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is web::json::value()
equivalent to null in this case?
auto handshake_exception = std::current_exception(); | ||
connection->m_connection->stop([callback, handshake_exception](std::exception_ptr) | ||
{ | ||
callback(handshake_exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we merge or log the stop exception if there is one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We log the exception in connection_impl::stop
set_result(json::value::null()); | ||
else | ||
{ | ||
set_result(json::value::null()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be web::json::value()
instead? The docs seem to indicate that value()
is just a null value and null()
is "A JSON null value".
This comment was made automatically. If there is a problem contact ryanbrandenburg. I've triaged the above build. |
Built on top of #8420Part of #8718