直接打印SockException类

This commit is contained in:
xiongziliang 2023-04-23 00:10:18 +08:00
parent de8249592e
commit c8a20f85f6
15 changed files with 17 additions and 20 deletions

@ -1 +1 @@
Subproject commit 1337142746b84ef157a455aefcae5523baa22404
Subproject commit a73cda127c221b788cc02db5ad98e49b0da56d52

View File

@ -966,7 +966,7 @@ void installWebApi() {
//开始推流,如果推流失败或者推流中止,将会自动重试若干次,默认一直重试
pusher->setPushCallbackOnce([cb, key, url](const SockException &ex) {
if (ex) {
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex.what();
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex;
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
s_proxyPusherMap.erase(key);
}
@ -975,7 +975,7 @@ void installWebApi() {
//被主动关闭推流
pusher->setOnClose([key, url](const SockException &ex) {
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex.what();
WarnL << "Push " << url << " failed, key: " << key << ", err: " << ex;
lock_guard<recursive_mutex> lck(s_proxyPusherMapMtx);
s_proxyPusherMap.erase(key);
});

View File

@ -96,7 +96,7 @@ static onceToken token([]() {
static void parse_http_response(const SockException &ex, const Parser &res, const function<void(const Value &, const string &, bool)> &fun) {
bool should_retry = true;
if (ex) {
auto errStr = StrPrinter << "[network err]:" << ex.what() << endl;
auto errStr = StrPrinter << "[network err]:" << ex << endl;
fun(Json::nullValue, errStr, should_retry);
return;
}

View File

@ -266,7 +266,7 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const MediaSourceE
if (auto strong_self = weak_self.lock()) {
// 可能归属线程发生变更
strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() {
WarnL << "stream:" << strong_self->shortUrl() << " stop send rtp:" << ssrc << ", reason:" << ex.what();
WarnL << "stream:" << strong_self->shortUrl() << " stop send rtp:" << ssrc << ", reason:" << ex;
strong_self->_rtp_sender.erase(ssrc);
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastSendRtpStopped, *strong_self, ssrc, ex);
});

View File

@ -118,7 +118,7 @@ void HlsPlayer::fetchSegment() {
return;
}
if (err) {
WarnL << "Download ts segment " << url << " failed:" << err.what();
WarnL << "Download ts segment " << url << " failed:" << err;
if (err.getErrCode() == Err_timeout) {
strong_self->_timeout_multiple = MAX(strong_self->_timeout_multiple + 1, MAX_TIMEOUT_MULTIPLE);
}else{

View File

@ -101,7 +101,7 @@ void HttpSession::onError(const SockException& err) {
uint64_t duration = _ticker.createdTime() / 1000;
WarnP(this) << "FLV/TS/FMP4播放器("
<< _mediaInfo.shortUrl()
<< ")断开:" << err.what()
<< ")断开:" << err
<< ",耗时(s):" << duration;
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
@ -111,9 +111,6 @@ void HttpSession::onError(const SockException& err) {
}
return;
}
//http客户端
TraceP(this) << err.what();
}
void HttpSession::onManager() {

View File

@ -101,7 +101,7 @@ void RtmpPlayer::onPlayResult_l(const SockException &ex, bool handshake_done) {
return;
}
WarnL << ex.getErrCode() << " " << ex.what();
WarnL << ex.getErrCode() << " " << ex;
if (!handshake_done) {
//开始播放阶段
_play_timer.reset();

View File

@ -336,7 +336,7 @@ void RtpSender::onFlushRtpList(shared_ptr<List<Buffer::Ptr> > rtp_list) {
void RtpSender::onErr(const SockException &ex) {
_is_connect = false;
WarnL << "send rtp connection lost: " << ex.what();
WarnL << "send rtp connection lost: " << ex;
onClose(ex);
}

View File

@ -260,7 +260,7 @@ void RtpServer::connectToServer(const std::string &url, uint16_t port, const fun
return;
}
if (err) {
WarnL << "连接到服务器 " << url << ":" << port << " 失败 " << err.what();
WarnL << "连接到服务器 " << url << ":" << port << " 失败 " << err;
} else {
InfoL << "连接到服务器 " << url << ":" << port << " 成功";
strong_self->onConnect();

View File

@ -60,7 +60,7 @@ void RtpSession::onRecv(const Buffer::Ptr &data) {
}
void RtpSession::onError(const SockException &err) {
WarnP(this) << _stream_id << " " << err.what();
WarnP(this) << _stream_id << " " << err;
}
void RtpSession::onManager() {

View File

@ -57,7 +57,7 @@ void ShellSession::onRecv(const Buffer::Ptr&buf) {
}
void ShellSession::onError(const SockException &err){
WarnP(this) << err.what();
WarnP(this) << err;
}
void ShellSession::onManager() {

View File

@ -117,7 +117,7 @@ void SrtSession::onError(const SockException &err) {
// udp链接超时但是srt链接不一定超时因为可能存在udp链接迁移的情况
//在udp链接迁移时新的SrtSession对象将接管SrtSession对象的生命周期
//本SrtSession对象将在超时后自动销毁
WarnP(this) << err.what();
WarnP(this) << err;
if (!_transport) {
return;

View File

@ -33,7 +33,7 @@ protected:
}
//被动断开连接回调
void onErr(const SockException &ex) override {
WarnL << ex.what();
WarnL << ex;
}
//tcp连接成功后每2秒触发一次该事件
void onManager() override {
@ -42,7 +42,7 @@ protected:
}
//连接服务器结果回调
void onConnect(const SockException &ex) override{
DebugL << ex.what();
DebugL << ex;
}
//数据全部发送完毕后回调

View File

@ -103,7 +103,7 @@ void WebRtcSession::onError(const SockException &err) {
//udp链接超时但是rtc链接不一定超时因为可能存在链接迁移的情况
//在udp链接迁移时新的WebRtcSession对象将接管WebRtcTransport对象的生命周期
//本WebRtcSession对象将在超时后自动销毁
WarnP(this) << err.what();
WarnP(this) << err;
if (!_transport) {
return;

View File

@ -1054,7 +1054,7 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, int &len, void *ctx
}
void WebRtcTransportImp::onShutdown(const SockException &ex) {
WarnL << ex.what();
WarnL << ex;
unrefSelf();
for (auto &tuple : _ice_server->GetTuples()) {
tuple->shutdown(ex);