实现whip/whep delete相关功能

通过whip/whep 回复http头中的Location url进行删除资源
新增delete token随机数实现删除鉴权
This commit is contained in:
xia-chu
2023-04-28 22:06:46 +08:00
parent d2349f01bd
commit 8c049d4e28
4 changed files with 44 additions and 4 deletions

View File

@@ -113,6 +113,13 @@ const string &WebRtcTransport::getIdentifier() const {
return _identifier;
}
const std::string& WebRtcTransport::deleteRandStr() const {
if (_delete_rand_str.empty()) {
_delete_rand_str = makeRandStr(32);
}
return _delete_rand_str;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void WebRtcTransport::OnIceServerSendStunPacket(
@@ -1053,6 +1060,15 @@ void WebRtcTransportImp::onBeforeEncryptRtp(const char *buf, int &len, void *ctx
}
}
void WebRtcTransportImp::safeShutdown(const SockException &ex) {
std::weak_ptr<WebRtcTransportImp> weak_self = static_pointer_cast<WebRtcTransportImp>(shared_from_this());
getPoller()->async([ex, weak_self]() {
if (auto strong_self = weak_self.lock()) {
strong_self->onShutdown(ex);
}
});
}
void WebRtcTransportImp::onShutdown(const SockException &ex) {
WarnL << ex;
unrefSelf();