mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Support destroy session
This commit is contained in:
parent
4c7792f0f3
commit
6a191e4077
2 changed files with 15 additions and 0 deletions
|
@ -682,6 +682,19 @@ srs_error_t SrsRtcServer::setup_session2(SrsRtcSession* session, SrsRequest* req
|
|||
return err;
|
||||
}
|
||||
|
||||
void SrsRtcServer::destroy(SrsRtcSession* session)
|
||||
{
|
||||
std::map<std::string, SrsRtcSession*>::iterator it;
|
||||
|
||||
if ((it = map_username_session.find(session->username())) != map_username_session.end()) {
|
||||
map_username_session.erase(it);
|
||||
}
|
||||
|
||||
if ((it = map_id_session.find(session->peer_id())) != map_id_session.end()) {
|
||||
map_id_session.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
bool SrsRtcServer::insert_into_id_sessions(const string& peer_id, SrsRtcSession* session)
|
||||
{
|
||||
return map_id_session.insert(make_pair(peer_id, session)).second;
|
||||
|
|
|
@ -113,6 +113,8 @@ public:
|
|||
// We start offering, create_session2 to generate offer, setup_session2 to handle answer.
|
||||
srs_error_t create_session2(SrsSdp& local_sdp, SrsRtcSession** psession);
|
||||
srs_error_t setup_session2(SrsRtcSession* session, SrsRequest* req, const SrsSdp& remote_sdp);
|
||||
// Destroy the session from server.
|
||||
void destroy(SrsRtcSession* session);
|
||||
public:
|
||||
bool insert_into_id_sessions(const std::string& peer_id, SrsRtcSession* session);
|
||||
void check_and_clean_timeout_session();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue