drogonframework / drogonframework/drogon
WebSocketClientImpl::stop also need to run the loop thread
Open
enhancement
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
If I call stop on another thread, It will be core dump,because `onRecvMessage `will use `websockConnPtr_`
```
void WebSocketClientImpl::stop()
{
stop_ = true;
if (websockConnPtr_)
{
websockConnPtr_->shutdown();
websockConnPtr_.reset();
}
tcpClientPtr_.reset();
}
tcpClientPtr_->setMessageCallback(
[weakPtr](const trantor::TcpConnectionPtr &connPtr,
trantor::MsgBuffer *msg) {
auto thisPtr = weakPtr.lock();
if (thisPtr)
{
thisPtr->onRecvMessage(connPtr, msg);
}
});
```
Contributor guide
Assessment
This issue has not been assessed yet.