diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 068989aa..d011df90 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -614,6 +614,7 @@ void WebRtcTransport::setOnShutdown(function 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); diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 1d0c4d10..0aa9811a 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -257,6 +257,7 @@ private: std::shared_ptr _check_timer; std::function _on_start; std::function _on_shutdown; + toolkit::SockException _ex; #ifdef ENABLE_SCTP RTC::SctpAssociationImp::Ptr _sctp;