mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 20:15:58 +08:00
NoticeCenter支持安全类型转换,解决监听者参数类型不一致导致的bug
This commit is contained in:
@@ -170,7 +170,7 @@ void HttpSession::onError(const SockException &err) {
|
||||
|
||||
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
|
||||
if (_total_bytes_usage >= iFlowThreshold * 1024) {
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _mediaInfo, _total_bytes_usage, duration, true, static_cast<SockInfo &>(*this));
|
||||
NOTICE_EMIT(BroadcastFlowReportArgs, Broadcast::kBroadcastFlowReport, _mediaInfo, _total_bytes_usage, duration, true, *this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffix
|
||||
}
|
||||
};
|
||||
|
||||
auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastMediaPlayed, _mediaInfo, invoker, static_cast<SockInfo &>(*this));
|
||||
auto flag = NOTICE_EMIT(BroadcastMediaPlayedArgs, Broadcast::kBroadcastMediaPlayed, _mediaInfo, invoker, *this);
|
||||
if (!flag) {
|
||||
// 该事件无人监听,默认不鉴权
|
||||
onRes("");
|
||||
@@ -711,7 +711,7 @@ bool HttpSession::emitHttpEvent(bool doInvoke) {
|
||||
};
|
||||
///////////////////广播HTTP事件///////////////////////////
|
||||
bool consumed = false; // 该事件是否被消费
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastHttpRequest, _parser, invoker, consumed, static_cast<SockInfo &>(*this));
|
||||
NOTICE_EMIT(BroadcastHttpRequestArgs, Broadcast::kBroadcastHttpRequest, _parser, invoker, consumed, *this);
|
||||
if (!consumed && doInvoke) {
|
||||
// 该事件无人消费,所以返回404
|
||||
invoker(404, KeyValue(), HttpBody::Ptr());
|
||||
|
||||
Reference in New Issue
Block a user