Skip to content

Commit 43ec46e

Browse files
committed
Fixing up compilation error in websocket pull request.
1 parent 3e075fe commit 43ec46e

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Release/src/websockets/client/ws_client_winrt.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,27 @@ class winrt_callback_client : public websocket_client_callback_impl, public std:
182182
std::weak_ptr<winrt_callback_client> thisWeakPtr = shared_from_this();
183183
return pplx::create_task(m_msg_websocket->ConnectAsync(uri)).then([thisWeakPtr](pplx::task<void> result) -> pplx::task<void>
184184
{
185-
try
186-
{
187-
// result.get() should happen before anything else, to make sure there is no unobserved exception
188-
// in the task chain.
189-
result.get();
185+
// result.get() should happen before anything else, to make sure there is no unobserved exception
186+
// in the task chain.
187+
result.get();
190188

191-
std::shared_ptr<winrt_callback_client> pThis(thisWeakPtr.lock());
192-
if (pThis == nullptr)
189+
if (auto pThis = thisWeakPtr.lock())
190+
{
191+
try
193192
{
194-
throw websocket_exception("Websocket client is being destroyed");
193+
pThis->m_messageWriter = ref new DataWriter(pThis->m_msg_websocket->OutputStream);
195194
}
196-
197-
pThis->m_messageWriter = ref new DataWriter(m_msg_websocket->OutputStream);
195+
catch (Platform::Exception^ e)
196+
{
197+
throw websocket_exception(e->HResult, build_error_msg(e, "ConnectAsync"));
198+
}
199+
pThis->m_connected = true;
198200
}
199-
catch (Platform::Exception^ e)
201+
else
200202
{
201-
throw websocket_exception(e->HResult, build_error_msg(e, "ConnectAsync"));
203+
return pplx::task_from_exception<void>(websocket_exception("Websocket client is being destroyed"));
202204
}
203-
m_connected = true;
205+
204206
return pplx::task_from_result();
205207
});
206208
}

0 commit comments

Comments
 (0)