修复ice建连成功前关闭WebRtcTransport对象失败的bug

This commit is contained in:
xiongziliang
2026-08-26 17:36:54 +08:00
parent fdaec2604d
commit 39eac339d5
2 changed files with 5 additions and 0 deletions

View File

@@ -614,6 +614,7 @@ void WebRtcTransport::setOnShutdown(function<void(const SockException &ex)> cb)
void WebRtcTransport::onShutdown(const SockException &ex) {
TraceL << ex;
_ex = ex;
if (_on_shutdown) {
_on_shutdown(ex);
}
@@ -745,6 +746,9 @@ static bool isDtls(const char *buf) {
}
void WebRtcTransport::inputSockData(const char *buf, int len, const SocketHelper::Ptr& socket, struct sockaddr *addr, int addr_len) {
if (_ex) {
throw _ex;
}
IceTransport::Pair::Ptr pair;
if (addr != nullptr) {
auto peer_host = SockUtil::inet_ntoa(addr);

View File

@@ -257,6 +257,7 @@ private:
std::shared_ptr<toolkit::Timer> _check_timer;
std::function<void()> _on_start;
std::function<void(const toolkit::SockException &ex)> _on_shutdown;
toolkit::SockException _ex;
#ifdef ENABLE_SCTP
RTC::SctpAssociationImp::Ptr _sctp;